首先在项目的POM文件中,添置distributionManagement属性;
用于指明项目提交到地方!
Pom.xml设置:
http://host:8080/nexus 是可以連到nexus server的url <id>nexus</id>
是辨識用的repository id,必須跟下面的settings.xml一致。
<distributionManagement> <!-- use the following if you're not using a snapshot version. --> <repository> <id>nexus</id> <name>Internal Releases</name> <url>http://host:8080/nexus/content/repositories/releases</url> </repository> <!-- use the following if you ARE using a snapshot version. --> <snapshotRepository> <id>nexus</id> <name>Internal Releases</name> <url>http://host:8080/nexus/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement>
.settings.xml文件设置:
<id>nexus</id>
是辨識用的repository id,必須跟上面的pom.xml中的一致
<servers> <server> <id>nexus</id> <username>username</username> <password>password</password> </server> <server> <id>thirdparty</id> <username>username</username> <password>password</password> </server> </servers>
最后一步,执行deploy命令,实现发布:
mvn deploy