Maven: skip test-compile in the life cycle?

fei picture fei · Apr 26, 2011 · Viewed 44.5k times · Source

I have project that I set to build with the test-jar and normal jar by using this setting:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

The problem with this is whenever I upgrade the project version in the pom, I need to do a build with the tests, otherwise maven won't be able to find the test-jar with the correct version during the test-compile phrase. A lot of time I would just want to skip the tests, but due to the test-jar missing, the test-compilephrase will fail.

I tried to use -Dmaven.test.skip=true, but that doesn't seem to skip the test-compile phase. Is there a way to skip this?

Answer

gavenkoa picture gavenkoa · Nov 11, 2014
$ mvn clean install -Dmaven.test.skip=true \
      -Dmaven.site.skip=true -Dmaven.javadoc.skip=true