我想阻止Jenkins构建(因此重新部署)Maven项目的已发布版本。 Artifactory(正确)不允许重新部署已发布的版本。
我正在使用Maven配置文件“jenkins”来运行在Jenkins中运行的所有版本
答案 0 :(得分:6)
<profile>
<id>jenkins</id>
<!-- This profile is activated by the "-P jenkins" switch when run on
the build server by Jenkins (continuous integration) -->
<build>
<plugins>
<!-- Jenkins should only build -SNAPSHOTs -->
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<evaluateBeanshell>
<condition>"${project.version}".endsWith("-SNAPSHOT")</condition>
<message>Jenkins should only build -SNAPSHOT versions</message>
</evaluateBeanshell>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>