如何使Maven发布插件跳过测试? [英] how to make maven release plugin skip tests?
问题描述
我正在 Spotify的docker-client 的主结帐上运行mvn release:prepare -Darguments="-Dmaven.test.skip=true -DskipTests"
.但是我无法获得Maven的发布插件来跳过测试.为什么在这种情况下maven不尊重CLI标志?
I'm running mvn release:prepare -Darguments="-Dmaven.test.skip=true -DskipTests"
on the master checkout of Spotify's docker-client. But I can't get maven's release plugin to skip the tests. Why doesn't maven in this case respect the CLI flags?
我也很好奇是什么导致释放插件执行surefire插件.在pom.xml
中没有指定surefire插件.
I'm also curious what causes the release plugin to execute the surefire-plugin. There's no surefire-plugin specified in pom.xml
.
mvn --version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)
Maven home: /usr/local/Cellar/maven/3.2.5/libexec
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.2", arch: "x86_64", family: "mac"
推荐答案
有两件事.首先,如果您想运行发行版,则需要运行mvn release:perform
,它实际上运行的是最终发行版的步骤,而不是mvn release:prepare
.如果您想跳过mvn release:prepare
中的测试,则应使用mvn -Dmaven.test.skip=true
加上您已定义的给定参数.
There are two things. First if you like to run a release you need to run mvn release:perform
which really runs the step for the final release and not the mvn release:prepare
. If you like to skip the tests in mvn release:prepare
you should use mvn -Dmaven.test.skip=true
plus the given arguments you have defined.
除了该maven-surefire-plugin之外,它还在默认生命周期
Apart from that maven-surefire-plugin is defined in the default life cylce
这篇关于如何使Maven发布插件跳过测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!