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
- Maven compilation error: package does not exist jar package does not exist
- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test)
- Update project manually_ Solution of too large jar package in springboot
- Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/mai
- 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)
- Maven invalid source release 11
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Hello
- An error is reported when executing MVN. The diamond operator is not supported in source-1.5
- Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.
- The import Maven project appears http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Solutions
- MVN error: @ param not found
- The common module of idea Maven parent-child project packages and reports an error
- Failed to execute goal org.apache.maven . plugins:maven-surefire-plugin :2.12.4:test
- Idea Maven project uses package to package and report error (package does not exist)
- appear Error:java : javacTask: source release 1.7 requires target release 1.7
- Process exited with an error: 1 (Exit value: 1)
- javac Task Error source release 1.7 requires target release
- Solve the problem that target code version of Maven project sub module in IntelliJ idea is always rolled back