如果你安装了maven nexus,想把本地的mvaen项目生成的jar/war包部署到服务器的maven仓库中去,可以用命令“mvn deploy”执行。
前提是你需要在项目的pom.xml里面加上这样的配置
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Release Repository</name>
<url>
http://172.16.88.47:8081/nexus/content/repositories/releases/
</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshot Repository</name>
<url>
http://172.16.88.47:8081/nexus/content/repositories/snapshots/
</url>
</snapshotRepository>
</distributionManagement>
结果如下
<project>
<dependencies>
...
</dependencies>
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Release Repository</name>
<url>
http://172.16.88.47:8081/nexus/content/repositories/releases/
</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshot Repository</name>
<url>
http://172.16.88.47:8081/nexus/content/repositories/snapshots/
</url>
</snapshotRepository>
</distributionManagement>
</project>
然后在终端中执行“mvn deploy” 必要的话,可以skip tests
就可以发布这个项目的jar/war包到nexus仓库中去了。