发布软件包时,需要配置两个地方:
~/.m2/settings.xml
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
pom.xml
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://192.168.43.164:8090/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus snapshots Repository</name>
<url>http://192.168.43.164:8090/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
注:有关Nexus的内容具体见软件开发相关工具/Nexus-私有包管理仓库/Maven仓库类型
,阅读本篇前应先复习Nexus部署相关知识。
有时我们希望一个Maven多模块项目编译部署时,忽略指定模块的上传,此时可以在对应模块中使用如下配置:
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>