how to make maven release plugin skip tests?

依然范特西╮ 提交于 2019-12-03 09:36:40
khmarbaise

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.

Apart from that maven-surefire-plugin is defined in the default life cylce

This worked for me. I wanted to both prepare and perform the release.

mvn clean -DskipTests -Darguments=-DskipTests release:prepare release:perform

I have used the following in my pom.xml

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <configuration>
                <tagNameFormat>v@{project.version}</tagNameFormat>
                <arguments>-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true</arguments>
            </configuration>
        </plugin>

This works with Maven 3.6 (and probably some earlier versions).

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.5.3</version>
    <configuration>
        <arguments>-DskipTests</arguments>
    </configuration>
</plugin>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!