Maven skip unit test- maven.test.skip And skipstests



-Dskiptests: do not execute test cases, but compile test case classes to generate corresponding class files under target / test classes.

– Dmaven.test.skip=true , do not execute test cases, and do not compile test case classes.

Do not execute the test case, but compile the test case class to generate the corresponding class file to target / test classes.

I. use maven.test.skip To skip not only the running of unit tests, but also the compiling of test code.

mvn package -Dmaven.test.skip=true  

It can also be in the pom.xml File modification

<plugin>  
    <groupId>org.apache.maven.plugin</groupId>  
    <artifactId>maven-compiler-plugin</artifactId>  
    <version>2.1</version>  
    <configuration>  
        <skip>true</skip>  
    </configuration>  
</plugin>  
<plugin>  
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-surefire-plugin</artifactId>  
    <version>2.5</version>  
    <configuration>  
        <skip>true</skip>  
    </configuration>  
</plugin> 

Second, use MVN package – dskipstests to skip the unit test, but will continue to compile; if there is no time to modify the unit test bug, or the unit test compilation error. Use the one above, not this one

<plugin>  
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-surefire-plugin</artifactId>  
    <version>2.5</version>  
    <configuration>  
        <skipTests>true</skipTests>  
    </configuration>  
</plugin> 

=

Read More: