1、单个仓库配置如下,发布到远程仓库的命令是:mvn deploy
<distributionManagement>
<repository>
<id>nexus-releases-local</id>
<name>Nexus Release Repository</name>
<url>http://{ip}:{port}/nexus/content/repositories/releases/</url> //配置私服的地址
</repository>
<snapshotRepository>
<id>nexus-snapshots-local</id>
<name>Nexus RELEASE Repository</name>
<url>http://{ip}:{port}/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
2、多个仓库配置如下,发布到远程仓库的命令是:mvn deploy -P {仓库id}
<profiles>
<profile>
<id>chengDu</id> //配置仓库1的id
<distributionManagement>
<repository>
<id>nexus-releases-local</id>
<name>Nexus Release Repository</name>
<url>http://{ip}:{port}/nexus/content/repositories/releases/</url> //配置私服的地址
</repository>
<snapshotRepository>
<id>nexus-snapshots-local</id>
<name>Nexus RELEASE Repository</name>
<url>http://{ip}:{port}/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>shenZhen</id> //配置仓库2的id
<distributionManagement>
<repository>
<id>nexus-releases-local</id>
<name>Nexus Release Repository</name>
<url>http://{ip}:{port}/nexus/content/repositories/releases/</url> //配置私服的地址
</repository>
<snapshotRepository>
<id>nexus-snapshots-local</id>
<name>Nexus RELEASE Repository</name>
<url>http:/{ip}:{port}/nexus/content/repositories/snapshots/</url> //配置私服的地址
</snapshotRepository>
</distributionManagement>
<activation>
<activeByDefault>true</activeByDefault> //设置默认仓库为仓库2
</activation>
</profile>
</profiles>