[英]mvn deploy:file to different repositories for snapshot and release version
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? 是否有可能以某种方式告诉maven部署:文件目标是根据项目的版本是快照/发布来部署到两个独立的工件?
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). 我希望可能有一个属性表明该版本具有-SNAPSHOT前置的事实,或者可能是要部署到的默认工件(已经根据版本号计算出来)。
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. 我想过使用两个不同的配置文件,并通过解析pom.xml文件来解决它在ant中的快照,但如果可能的话,我宁愿使用更干净的解决方案。
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>
Many Thanks 非常感谢
如果您在settings.xml中定义了存储库,则可以使用
mvn deploy:deploy-file -DrepositoryId=releases -DartifactId=... -Durl=
也许你想使用build-helper-maven-plugin来部署一个额外的工件
This is presumably the Maven way: 这可能是Maven的方式:
<distributionManagement>
<repository>
<id>release</id>
<url>http://my-releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://my-snapshots</url>
</snapshotRepository>
</distributionManagement>
When doing a deploy of a snapshot version, it'll go the snapshots repository. 在部署快照版本时,它将进入快照存储库。 For a non-snapshot release the regular repository will be used.
对于非快照版本,将使用常规存储库。
Just run deploy and it'll work. 只需运行部署就可以了。 :-)
:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.