Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test
There is a mave aggregation project. The following error is reported when packaging through the maven command:
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test
The packaging command is as follows: clean package
Solution 1:
Click Toggle ‘Skip Tests’ mode in the maven panel in idea tools, and package it again and it works fine.
Solution 2:
Specify skipTests as true in the pom file to skip unit tests
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
Solution 3:
Execute the command at the Terminal
mvn install -DskipTests
Solution 4:
Execute the command at the Terminal
mvn install -Dmaven.test.skip=true
Solution 5:
In the springboot project, spring-boot-maven-plugin plugin has been integrated with the maven-surefire-plugin plugin, will automatically run junit test, you need to add the following configuration in the pom
<properties>
<!-- skip the test -->
<skipTests>true</skipTests>
</properties>
Among them, -Dmaven.test.skip=true and -DskipTests have the following roles
- -DskipTests: does not execute the test cases, but compiles the test case classes to generate the corresponding class files under target/test-classes.
- -Dmaven.test.skip=true: does not execute the test cases and does not compile the test case classes.
Read More:
- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test)
- Failed to execute goal org.apache.maven . plugins:maven-surefire-plugin :2.12.4:test
- 解决Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on pr
- Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
- RocketMQ Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check…
- How to Fix Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile
- Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:jar (default) on project
- Failed to execute goal org.apache.maven . plugins:maven-clean-plugin :2.6.1:cle
- Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on
- Failed to execute goal org.apache.tomcat . maven:tomcat7-maven-plugin : 2.2: run solution
- Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on project
- Failed to execute goal in Maven build org.apache.tomcat .maven:
- “[warning] failed to retrieve plugin descriptor for caused by Maven security agent settings org.apache.maven . plugins:… “
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Hello
- mvn install Error: Failed to read artifact descriptor org.apache.maven.plugins:maven-install-plugin:jar:2
- Error resolving version for plugin ‘org.apache.maven.plugins:maven-compiler-plugin’ from the repo…
- Cannot resolve plugin org.apache.maven.plugins:maven-jar-plugin:2.4