Maven build fails because of maven-surefire-plugin

14,200

add following code into POM.xml, and update maven project.

<project>
  [...]
    <build>
     <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <useSystemClassLoader>false</useSystemClassLoader>
        </configuration>
      </plugin>
    </plugins>
  </build>
 [...]

Share:
14,200
tryingHard
Author by

tryingHard

For fun: java, c# for less fun: Ruby, Scala, javascript, html, css, oracle adf Like chillstep music - https://www.youtube.com/watch?v=YhtzEXCzLNM

Updated on June 05, 2022

Comments

  • tryingHard
    tryingHard almost 2 years

    I have similiar problem that was here maven-surefire-plugin missing in eclipse

    But I did what was in answer of that question and still my build fails with the same error.

    MCVE here: https://github.com/yami12376/AspectJ

    When i build i get:

    [WARNING] Error injecting: org.apache.maven.plugin.surefire.SurefirePlugin
    java.lang.TypeNotPresentException: Type org.apache.maven.plugin.surefire.SurefirePlugin not present
            at 
    
        ...
    org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
            ... 57 more
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.216 s
    [INFO] Finished at: 2017-04-06T18:12:01+02:00
    [INFO] Final Memory: 13M/244M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project NumberGenerator: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: Unable to load the mojo 'test' in the plugin 'org.apache.maven.plugins:maven-surefire-plugin:2.12.4'. A required class is missing: org/apache/maven/plugin/surefire/SurefireReportParameters
    [ERROR] -----------------------------------------------------
    [ERROR] realm =    plugin>org.apache.maven.plugins:maven-surefire-plugin:2.12.4
    [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
    [ERROR] urls[0] = file:/C:/apache-maven-3.3.9/repositoryNewNexus/org/apache/maven/plugins/maven-surefire-plugin/2.12.4/maven-surefire-plugin-2.12.4.jar
    [ERROR] urls[1] = file:/C:/apache-maven-3.3.9/repositoryNewNexus/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
    [ERROR] Number of foreign imports: 1
    [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
    [ERROR]
    [ERROR] -----------------------------------------------------: org.apache.maven.plugin.surefire.SurefireReportParameters
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException