7

我想阻止 Jenkins 构建(从而重新部署)已发布版本的 Maven 项目。Artifactory(正确)不允许重新部署已发布的版本。

我正在为在 Jenkins 中运行的所有构建使用 Maven 配置文件“jenkins”

4

1 回答 1

5
<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>
于 2012-05-10T16:02:02.057 回答