Maven -DskipTests ignored

NeplatnyUdaj picture NeplatnyUdaj · Nov 7, 2013 · Viewed 98.7k times · Source

I'm building a Maven project with following SureFire configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${version.maven-surefire-plugin}</version>
    <configuration>
        <includes>
            <include>**/*Test.java</include>
        </includes>
    </configuration>
</plugin>

Problem is, that when I build it with mvn clean install -DskipTests=true, the tests are still being executed. What could be the problem?

I tried both -DskipTests(which is from the Maven website) and -DskipTests=true, which is added by IntelliJ Idea when I check "skip tests" checkbox.

I don't use any Maven settings.xml.

  • Maven version: 2.2.1
  • Surefire plugin: 2.3

EDIT If I comment out the SureFire plugin configuration, the parameter behaves as I expect to. What could be the problem with the configuration above?

Answer

Jack picture Jack · Nov 7, 2013

Maven knows two types of parameters for skipping tests:

-Dmaven.test.skip=true 

or

-DskipTests=true 

The surefire-plugin documentation only mentions the first one, which you have not tried yet.