maven项目发布到nexus

来源:互联网 发布:淘宝刷单是真的吗 编辑:程序博客网 时间:2024/05/18 13:27


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 

就可以上传了 

0 0