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

前端 未结 28 1416
予麋鹿
予麋鹿 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:08

    This is what solves the problem:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
            <testFailureIgnore>true</testFailureIgnore>
        </configuration>
    </plugin>
    

    from Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test

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

    The problem is not in your dependencies.... you should open detail error on this path

    Please refer to D:\Masters\thesis related papers and tools\junitcategorizer\junitcategorizer.instrument\target\surefire-reports for the individual test results.

    the detail error's in there, maybe your service class or serviceImpl class or something missing like @anotation or else... i got error same with you,...u should try

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

    Change the version number to 2.19.1 works for me :)

    `<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
            <systemPropertyVariables>
                <xmlOutputDir>${project.build.directory}/surefire</xmlOutputDir>
            </systemPropertyVariables>
        </configuration>
    </plugin>`
    
    0 讨论(0)
  • 2020-12-03 07:11

    This is a kind of test failure.@SpringBootApplication annotation contains these configurations.

    1) @Configuration

    2) @ComponentScan

    3) @EnableAutoConfiguration

    @EnableAutoConfiguration is the reason for this error. This will try to automatically configure application according to dependencies in your pom.xml

    As a example when you have spring-data-jpa dependency in pom it will try to add configuration to application by looking at application.properties file for data source. So you need add data source to solve that.

    For MySQL :

    spring.jpa.hibernate.ddl-auto=create
    spring.datasource.url=jdbc:mysql://localhost/lahiru
    spring.datasource.username=root
    spring.datasource.password=
    

    Or

    You could hide this by skipping testing.

    mvn install -DskipTests
    

    For more details.

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

    This issue could be related to the already busy port. Surefire run on 5005 port. So you need to make sure that this port is free. If not change it or kill the process. This happens in Intellij some time.

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

    That worked for me,

    Right Click on project -> "Run as Maven Test". This will automatically download the missing plugins and than Right Click on project ->"Update Maven project" it removes the error.

    0 讨论(0)
提交回复
热议问题