mvn deploy:file到不同的存储库以获取快照和发行版 [英] mvn deploy:file to different repositories for snapshot and release version
问题描述
是否可以通过某种方式告诉maven deploy:file目标,以根据项目的版本是否为快照/发行版来部署到两个独立的工件?
Is it possible to in some way tell the maven deploy:file goal to deploy to two independent artifactories based on whether the version of the project is a snapshot / release?
我希望可能有一个属性,该属性指示该版本的前缀是-SNAPSHOT,或者可能是要部署到的默认工件(已经根据版本号进行了计算).
I'm hoping there might be a property which indicates the fact the version has -SNAPSHOT prepended, or perhaps the default artifactory to deploy to (which has been worked out based on the version number already).
我曾考虑过使用两个不同的配置文件,并通过解析pom.xml文件来确定它是否是ant的快照,但我宁愿使用更干净的解决方案.
I thought about using two different profiles and working out if its a snapshot in ant by parsing the pom.xml file, but I'd rather a cleaner solution if possible.
当前,我的deploy插件如下所示,但是无论版本如何,它都将部署到发布工件中.
Currently, my deploy plugin looks as follows, but this just deploys to the release artifactory regardless of the version;
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>deploy-zip-created-by-ant-to-artifactory</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>${project.distributionManagement.repository.id}</repositoryId>
<url>${project.distributionManagement.repository.url}</url>
<file>${project.basedir}/Build/deploy/MyArtifact.zip</file>
<pomFile>${project.basedir}/MyArtifact-pom.xml</pomFile>
</configuration>
</execution>
</executions>
</plugin>
非常感谢
推荐答案
如果您在settings.xml中定义了存储库,则可以使用
If you defined your repositories within your settings.xml you can use the
mvn deploy:deploy-file -DrepositoryId=releases -DartifactId=... -Durl=
这篇关于mvn deploy:file到不同的存储库以获取快照和发行版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!