nexus 学习记录过程。笔者也是刚起步,来记录下学习过程。
一、下载
1.下载地址
https://help.sonatype.com/repomanager3/download
右击复制链接
到我们centos指定的目录下wget
wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
解压压缩包
tar -zxvf nexus-3.14.0-04-unix.tar.gz
进入包下的bin目录,并后台启动。
/usr/local/nexus-3.14.0-04/bin
./nexus start
./nexus start为后台启动命令
./nexus stop为定制后台服务
./nexus status查看后台nexus服务状态
./nexus restart重启后台nexus服务
注:默认端口为8081,在/usr/local/nexus-3.14.0-04/etc/nexus-default.properties中可修改配置,一般修改端口,此例不改配置了。
二:配置私有仓储
这是可以访问我们的nexus,url为ip:8081
默认的帐号密码为:admin;admin123
sign in之后就出现了配置页面,可以创建仓储。
本次中不创建新的仓储,安装完默认有maven仓储,可以使用。接下来我们设置配置,在本地maven的setting.xml配置。
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://ip:8081/repository/qc-test/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
</settings>
在IDEA maven的pom.xml中配置
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Releases</name>
<url>http://xx.xx.xx.xx:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Snapshot</name>
<url>http://xx.xx.xx.xx:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
现在配置完成,
在我们的IDEA运行命令
mvn clean package