https://www.sonatype.com/nexus-repository-oss
定位:
一個免費的Maven 私服的倉庫
下載、安裝涌穆、啟動
$:tar xzf nexus-3.14.0-04-unix.tar.gz
$:cd nexus-3.14.0-04/bin
bin $:./nexus start
此時概疆,可以使用http://localhost:8081進行訪問奖唯,管理賬號為admin/admin123
,服務(wù)器上預(yù)提供了一些倉庫县恕,可以直接使用
屏幕快照 2018-11-04 下午10.01.34.png
加入私服的方法:
在pom.xml中加入:
<repositories>
<repository>
<id>maven-public</id>
<name>maven-public</name>
<url>http://localhost:8081/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
發(fā)布項目的方法:
- 在setting.xml中:
<servers>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
- 在"待布署的項目"的pom.xml中:
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>maven-releases</name>
<url>http://localhost:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>maven-snapshots</name>
<url>http://localhost:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
- 發(fā)布:
mvn deploy
為什么要設(shè)置group類型的倉庫
屏幕快照 2018-11-04 下午10.51.03.png