Maven -DskipTests ignored

What you did should work. How to debug this further:

  1. Run mvn help:effective-pom to see the whole POM that Maven will execute. Search it for test (case insensitive) to see if there is something odd.

  2. Run mvn test -X to get debug output. This will print the options used to configure the maven-surefire-plugin. Make sure you redirect the output to a file!

    In the log, you will see

    [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.15:test' with basic configurator -->
    

    and then, some lines below that:

    [DEBUG]   (s) runOrder = filesystem
    [DEBUG]   (s) skip = false
    [DEBUG]   (s) skipTests = false
    

    These values mean that tests aren't skipped.

  3. Are you using a recent version of the plugin? Check here. Maybe this option wasn't supported for your version.


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.


I'm not sure why the correct answer hasn't been posted yet. In older versions of SureFire the flag to compile tests but not run them is -Dmaven.test.skip.exec.


it is not -DskipTests=true it is just -DskipTests considering you are using surfire version 2.3

so you run it as

mvn install -DskipTests