考慮到你有要求,動態地控制目標庫中進行部署,你有多個選項:
1)使用Artifactory Jenkins插件的pipeline support。管道DSL允許你動態地控制你正在使用Maven分辨率/部署的存儲庫,例如:
def rtMaven = Artifactory.newMavenBuild()
rtMaven.resolver server: server, releaseRepo: 'libs-release', snapshotRepo: 'libs-snapshot'
rtMaven.deployer server: server, releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local'
並添加屬性:
rtMaven.deployer.addProperty("status", "in-qa").addProperty("compatibility", "1", "2", "3")
2)使用Artifactory Maven plugin它允許您定義來自pom.xml的解析/部署和屬性。您還可以利用environment variables or system properties以動態方式定義這些。 例如:
<build>
<plugins>
...
<plugin>
<groupId>org.jfrog.buildinfo</groupId>
<artifactId>artifactory-maven-plugin</artifactId>
<version>2.6.1</version>
<inherited>false</inherited>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>publish</goal>
</goals>
<configuration>
<deployProperties>
<build.name>{{BUILD_NAME}}</build.name>
</deployProperties>
<publisher>
<contextUrl>https://artifactory.mycompany.com</contextUrl>
<username>deployer</username>
<password>******</password>
<repoKey>{{RELEASE_REPO}}</repoKey>
<snapshotRepoKey>{{SNAPSHOT_REPO}}</snapshotRepoKey>
</publisher>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
3)通過@viniciusartur已經回答了,你可以使用matrix parameters存儲庫中的URL定義屬性
具有不同工件儲存器從我的觀點,但不同artifactory的服務器聲音意義錯誤...? – khmarbaise
在我的情況下,我可以同時擁有不同的工件存儲庫和artifactory服務器。根據項目的pom.xml,工件可以部署到不同的服務器上。 –
爲什麼不使用Jenkins Artifactory插件? https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin – Ariel