在測試環境將api to maven時,總是會報下面的錯
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project ts-distribution-biz: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
英文不好,加上對maven了解不是很透徹,花了一上午的時間才解決,distributionManagement標簽里沒有repository元素導致,這之前我都不知道distributionManagement這個東西。。。下面來介紹下
我在本地開發好之后,需要將項目推到遠程,一個公用的遠程倉庫,這樣別人就可以調用你的api。
但maven怎么知道要推到哪個遠程倉庫呢,distributionManagement就是負責將jar包推到指定的遠程倉庫。
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://127.0.0.1:8080/nexus/content/repositories/releases/</url> 或者<url>${repo.internal.snapshots.url}</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://127.0.0.1:8080/nexus/content/repositories/snapshots/</url> 或者<url>${repo.internal.releases.url}</url>
</snapshotRepository>
</distributionManagement>
maven會區分release版本和snapshot版本,遠程倉庫也會對穩定版和snapshot版進行區分。
其實url在settings.xml文件中配置了,所以直接使用占位符就可以了。
http://blog.csdn.net/ichsonx/article/details/49679161