You may want to configure Maven to skip unit tests entirely. Maybe you have a large system, unit tests take many minutes to complete, and you don’t want to wait for unit tests to complete before generating the final output. You may be working on a legacy system with a series of failed unit tests, and you may simply want to generate a JAR instead of fixing all the unit tests. Maven provides the ability to skip unit tests by using the Surefire plug-in’s skip
parameter. On the command line, simply add the maven.test.skip
attribute to any target:
$ mvn install -Dmaven.test.skip=true
…
[INFO] [compiler:testCompile]
[INFO] Not compiling test sources
[INFO] [surefire:test]
[INFO] Tests are skipped.
…
If maven.test.skip
is set to true
when the Surefire plug-in reaches the test
target, it skips the unit tests. Another way to configure Maven to skip unit tests is to add this configuration to your project’s pom.xml
. You need to add the plugin
element to your build
.
< project>
[…].
& lt; build>
& lt; plugins>
& lt; plugin>
& lt; groupId> org.apache.maven.plugins< /groupId>
& lt; artifactId> maven-surefire-plugin< /artifactId>
& lt; configuration>
& lt; skip> true< /skip>
& lt; /configuration>
& lt; /plugin>
& lt; /plugins>
& lt; /build>
[…].
< /project>
From http://blog.csdn.net/symgdwyh/article/details/4289080
Read More:
- Maven skip unit test- maven.test.skip And skipstests
- Multithreading: when doing unit test, use thread pool to find that the specified code is not running and skip directly
- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test)
- [Solved] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test
- Failed to execute goal org.apache.maven . plugins:maven-surefire-plugin :2.12.4:test
- [Solved] Unit test automatically injects error reporting nullpointer
- Solve the problem of springboot and unit test starting applicationrunner
- Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.
- Junit4 unit test reports an error invalid project specified
- The usage of Java JUnit unit test and the solution of initialization error
- Error in idea unit test command line is too long
- Spring configuration transaction, JUnit unit test error “failed to load ApplicationContext”
- [details] jar conflict resolution in Maven (personal test)
- The import Maven project appears http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Solutions
- Error resolving version for plugin ‘org.apache.maven.plugins:maven-compiler-plugin’ from the repo…
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
- “[warning] failed to retrieve plugin descriptor for caused by Maven security agent settings org.apache.maven . plugins:… “
- import org.junit.Test And @ test error reporting — solutions
- Failed to execute goal in Maven build org.apache.tomcat .maven:
- Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign