您的位置:首页 > 运维架构 > Linux

Linux服务器使用六:搭建自己的Sonatype Nexus Maven私有库

2016-12-04 20:32 447 查看

一、安装Sonatype Nexus

1、下载最新版的Sonatype Nexus并上传到linux服务器

2、拷贝并解压

cp nexus-latest-bundle.tar.gz /home/dfz/
mkdir nexus
tar -zxvf nexus-latest-bundle.tar.gz -C nexus


3、编辑nexus脚本,配置参数

vi /home/dfz/nexus/nexus-2.14.1-01/bin/nexus
#配置以下内容
RUN_AS_USER=root


4、启动nexus服务

./nexus start


访问http://Your-IP:8081/nexus/

即可进入管理页面



默认账户为:admin,默认密码为:admin123

二、Maven端配置

1、在本地库的配置文件setting.xml中加入以下配置:

<server>
<!-- 部署账户密码 -->
<id>nexus-releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>

<server>
<!-- 部署账户密码 -->
<id>nexus-snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>

<profile>
<id>dfz</id>

<activation>
<activeByDefault>false</activeByDefault>
<jdk>1.7</jdk>
</activation>
<!-- 配置私有库 -->
<repositories>
<repository>
<id>nexus</id>
<url>http://10.0.0.111:8081/nexus/content/groups/public/</url>
<releases>
<enable>true</enable>
</releases>
<snapshots>
<enable>true</enable>
</snapshots>
</repository>
</repositories>
<!-- 配置插件库 -->
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://10.0.0.111:8081/nexus/content/groups/public/</url>
<releases>
<enable>true</enable>
</releases>
<snapshots>
<enable>true</enable>
</snapshots>
</pluginRepository>
</pluginRepositories>

</profile>
<activeProfiles>
<activeProfile>dfz</activeProfile>
</activeProfiles>


2、在项目的pom.xml文件中加入

<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://10.0.0.111:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus SnapShot Repository</name>
<url>http://10.0.0.111:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>


完成私有库搭建
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  服务器