-
Note mvn compile the code will not compile in the Test directory, but mvn package by default when compiling code in the Test directory !!!
- This time you can use:
- -DskipTests, test is not performed, but the compiler generated test class file corresponding to the class target / test-classes.
- -Dmaven.test.skip = true, does not execute test cases, test cases are not compiled class.
First, using the maven.test.skip, only skip unit tests run, and test code compiled skipped.mvn package -Dmaven.test.skip=true
Can also be modified in the pom.xml file
<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, using the mvn package -DskipTests
skip unit testing, but will continue to compile; if no time modification unit testing bug, or unit test compilation errors. Using the above, do not use this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>