Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.

前端 未结 28 1415
予麋鹿
予麋鹿 2020-12-03 06:41

I have been trying from a couple of days to resolve the following error but I am unable to resolve it :(

My module\'s pom.xml file is:



        
相关标签:
28条回答
  • 2020-12-03 07:12

    It may be better to set the surefire-plugin version in the parent pom, otherwise including it as a dependency will override any configuration (includes file patterns etc) that may be inherited, e.g. from Spring Boots spring-boot-starter-test pom using pluginManagement

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    
    0 讨论(0)
  • 2020-12-03 07:13

    If there are test failures just skip them with

    mvn install -DskipTests
    

    but i strongly recomend fixing your test first.

    0 讨论(0)
  • 2020-12-03 07:15

    This error is brought up for many different reasons so everyone has a different solution. However, your own webapp should hold the answer for it.

    You can look it up in

    /module_with_failure/target/surefire-reports/*.txt

    0 讨论(0)
  • 2020-12-03 07:16

    This happens when Maven tries to run your test cases while building the jar. You can simply skip running the test cases by adding -DskipTests at the end of your maven command.

    Ex: mvn clean install -DskipTests or mvn clean package -DskipTests

    0 讨论(0)
  • 2020-12-03 07:16

    Just add those below line in pom.xml file on the top of <modelversion> tag:

    <repositories>
      <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>http://repo.maven.apache.org/maven2</url>
        <layout>default</layout>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>
      </repository>
    </repositories>
    
    0 讨论(0)
  • 2020-12-03 07:16

    surefire plugins version might be one of the reasons. For me following dependency worked. Please try:

        <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题