首先在项目的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
本文介绍如何通过配置POM文件和settings.xml文件将项目部署到Nexus仓库。首先需要在POM文件中添加distributionManagement属性指定发布路径,然后在settings.xml文件中设置身份验证信息。最后使用mvn deploy命令完成部署。
1037

被折叠的 条评论
为什么被折叠?



