nexus將本地文件推送到nexus中心庫
在本地搭建的nexus服務中,找到releases和snapshots這兩個庫對應的URL
http://localhost:8082/repository/maven-releases/
http://localhost:8082/repository/maven-snapshots/
maven,找到settingxml 配置文件
<servers>
...
<server>
<id>maven-releases</id>
<username>admin nexus用戶名</username>
<password>admin123 nexus密碼</password>
</server>
<server>
<id>maven-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
...
</servers>
在項目pom.xml文件中,做如下配置:
<distributionManagement>
<repository>
<id>maven-releases</id>
<url>http://localhost:8082/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>maven-snapshots</id>
<url>http://localhost:8082/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
注意層級
回到該項目文件的根目錄先后執行 mvn clean install / mvn clean deploy
看到
Uploaded to maven-snapshots即為成功
打開nexus倉庫頁面可以看到上傳的文件
還可以手動上傳
maven私服nexus上傳第三方jar包以及下載