我们需要将相同的工件部署到两个(或更多)nexus存储库中。 为此,我们使用的是有不同的distributionManagement
部分两个独立的配置文件是这样的:Maven发布插件:连续执行一些部署
<profile>
<id>deploy-nexus1</id>
<distributionManagement>
<repository>
<id>releases1</id>
<url>http://repositories/releases1</url>
</repository>
<snapshotRepository>
<id>snapshots1</id>
<url>http://repositories/snapshots1</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>deploy-nexus2</id>
<distributionManagement>
<repository>
<id>releases2</id>
<url>http://repositories/releases2</url>
</repository>
<snapshotRepository>
<id>snapshots2</id>
<url>http://repositories/snapshots2</url>
</snapshotRepository>
</distributionManagement>
</profile>
期望的结果:有相同artifact:1.0.0
在releases1
和releases2
。 但运行命令后:
mvn clean release:prepare -U
mvn clean release:perform -U -P deploy-nexus1
mvn clean release:perform -U -P deploy-nexus2
部署到releases1
库是成功的,但部署到releases2
返回:
没有SCM URL是提供从
进行释放。根据插件documentation,之前每release:perform
我们需要运行release:prepare
或提供自定义url来回购标签。
我们如何执行一个工件版本的两个nexus部署? 是否可以在release:perform
命令中添加额外的部署步骤?
在此先感谢。
我很抱歉怀疑你的做法,但它似乎很奇怪:为什么部署两次?如果你想让你的工件在不同的nexus实例中可用,你可以在nexus中使用代理库。你能否给我们一些背景知道你为什么要进行两次部署? –
当然,'nexus1'是我们的内部联系,我们会像往常一样使用它。如果需要的话,其他的Maven模块可以从'nexus1'下载它们的依赖关系。但'nexus2'是外部存储库,我们只在那里推送打包的应用程序,我们可以使用它来立即部署。公司应用程序'XXX Deploy'使用'nexus2',它从'nexus2'下载工件,将其解包到目标主机上并启动一个应用程序。因此,我们需要将工件上传到'nexus1',因为它是我们的主要纽带,并且上传到'nexus2',因为这需要持续交付过程。 –
我会考虑以下方法:在nexus1中代理您的nexus2。然后nexus2的所有工件也可以在nexus1中使用,而无需任何其他步骤。 –