![](/img/trans.png)
[英]How to publish artifacts on different maven repositories with Gradle?
[英]Deploy artifacts into two different remote repositories - Maven?
需要根據特定環境從兩個遠程存儲庫部署工件。 所以我嘗試在 pom.xml 中使用分布管理中的配置文件
<profiles>
<profile>
<id>dev-repository</id>
<activation>
<property>
<name>devRepo</name>
<value>true</value>
</property>
</activation>
<properties>
</properties>
<distributionManagement>
<repository>
<id>dev</id>
<url>https://nexus/dev</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
</profile>
<profile>
<id>qa-repository</id>
<activation>
<property>
<name>!devRepo</name>
</property>
</activation>
<properties>
</properties>
<distributionManagement>
<repository>
<id>qa</id>
<url>https://nexus/qa</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
</profile>
</profiles>
嘗試激活配置文件
> mvn clean deploy -PdevRepo
我收到以下錯誤。
部署失敗:在 distributionManagement 元素內的 POM 或 -DaltDeploymentRepository=id::layout::url 參數中未指定存儲庫元素
似乎 pom 無法識別 distributionMangement 標簽。
但是它在沒有用於單個分發管理的配置文件的情況下工作正常。
任何人請就此提出建議?
參考
我不使用配置文件,而是使用<url>https://nexus/${target.repo}</url>
形式的 url 定義 distributionManagement
然后你可以做類似mvn clean deploy -Ptarget.repo=dev
事情。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.