Nexus私服實現上傳jar和下載jar
1.Nexus下載(以Windows爲例)
1.1下載地址
https://blog.sonatype.com/
1.2下載完解壓即可
nexus-3.14.0-04-win64.zip
2.Nexus啓動
打開nexus-3.14.0-04\bin進入cmd窗口
nexus.exe /run
3.打開Nexus控制檯,登錄管理員賬戶
http://localhost:8081/
用戶名/密碼:admin/admin123
4.上傳jar包配置
4.1打開maven的setting.xml
配置快照版本以及發佈版本的服務
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
4.2打開maven項目的pom.xml
<distributionManagement>
<repository>
<id>releases</id>
<url>
http://localhost:8081/repository/maven-releases/
</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>
http://localhost:8081/repository/maven-snapshots/
</url>
</snapshotRepository>
</distributionManagement>
打開nexus首頁進入設置頁面,點擊repositories,複製快照版本地址以及發佈版本地址,替換上面對應的url信息
4.3查看上傳後的結果
在首頁點擊moven,即可查看
5.下載jar配置
5.1nexus配置阿里的倉庫
http://maven.aliyun.com/nexus/content/groups/public/
5.2配置倉庫組
將阿里的倉庫、快照版本倉庫和發佈版本倉庫添加進去
5.3maven的setting.xml配置倉庫組如下
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
<mirror>
<id>nexus</id>
<name>nexus</name>
<url>http://localhost:8081/repository/nexus/</url>
<mirrorOf>central</mirrorOf>
</mirror>