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

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

请您参考如下方法:

<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> 


评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!