本文將以開源的Nexus爲例,演示如何將本身開發的項目部署到Nexus Repository中,解決項目發佈、升級的問題。 html
Nexus只需下載war包放到tomcat服務器上即可。
api
<distributionManagement> <repository> <id>releases</id> <name>Nexus Release Repository</name> <url>http://localhost:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <name>Nexus Snapshot Repository</name> <url>http://localhost:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
<servers> <server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> </servers>
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ tenpay --- tomcat
Uploading: http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/1.2/tenpay-1.2.jar
Uploading: http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/1.2/tenpay-1.2.pom
Uploaded: http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/1.2/tenpay-1.2.pom (2 KB at 9.7 KB/sec)
Uploaded: http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/1.2/tenpay-1.2.jar (39 KB at 124.4 KB/sec)
Downloading: http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/maven-metadata.xml
Downloaded: http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/maven-metadata.xml (347 B at 4.3 KB/sec)
Uploading: http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/maven-metadata.xml
Uploaded: http://localhost:8081/nexus/content/repositories/releases/com/capital/tenpay/maven-metadata.xml (376 B at 7.8 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
服務器