Release版本的項目應該發佈到Releases倉庫中,對應的,Snapshot版本應該發佈到Snapshots倉庫中。Maven根據pom.xml文件中版本號<version>節點的屬性是否包含-SNAPSHOT,來判斷該項目是否是snapshot版本。如果是snapshot版本,在執行mvn deploy部署命令時,maven會自動將項目發佈到Snapshots倉庫。要發佈項目,首先需要將Releases倉庫和Snapshots倉庫的“Deployment Policy”設置爲“Allow Redeploy”
修改settin.xml文件,一般使用deployment 來發布項目
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>User Porject Snapshot</name>
<url>http://192.168.20.127:8081/nexus/content/repositories/snapshots/</url>
<uniqueVersion>true</uniqueVersion>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<name>User Porject Release</name>
<url>http://192.168.20.127:8081/nexus/content/repositories/releases/</url>
</repository>
</distributionManagement>
這裏的id要和setting.xm中的一致
run -->maven build-->deploy
就可以上傳了