20

I have configured all the dependencies in my pom.xml through maven. When i give the command mvn install I get the following error:

[INFO] Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test': Unable to load the mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test' in the plugin 'org.apache.maven.plugins:maven-surefire-plugin'. A required class is missing: org/apache/maven/surefire/util/NestedCheckedException org.apache.maven.surefire.util.NestedCheckedException

How can I resolve this problem?

wonea
  • 4,783
  • 17
  • 86
  • 139
kiara
  • 209
  • 1
  • 3
  • 5
  • 1
    Would you please past the pom here to be able to follow the explanation otherwise we could only take a look into our glass bulb... – khmarbaise Mar 23 '11 at 08:20

5 Answers5

25

You appear to be experiencing this issue: SUREFIRE-85.

The most likely cause appears to be corrupt jar files in your local repository. Try clearing out all maven jars from your local repository. Remove everything from <your-home-directory>/.m2/repository/org/apache/maven and run the build again.

Also, make sure you're using a stable, up-to-date version of Maven.

joelittlejohn
  • 11,665
  • 2
  • 41
  • 54
  • 4
    +1, had this problem and clearing out the local repository (in fact just deleting the "org" subdirectory) worked for me. – mikera Jul 17 '12 at 10:34
  • 1
    We had similar but not the same problem on our Jenkins CI server. Builds were fine (even with tests) but surfire reports failed with `InvocationTargetException` caused by `NoClassDefFoundError` caused by `ClassNotFoundException` this all ended after many more lines with `MojoExecutionException: Error occurred in starting fork, check output in log` -- cleaning `repository` on CI server indeed helped (cleaning just workspace of the project was not enough). Big thanks for this answer. – virgo47 Jan 02 '13 at 13:49
  • 1
    Thank you from the future. Just had this on a fresh maven enterprise project in netbeans and was mystified. – Alex Pritchard Feb 03 '15 at 19:08
2

I just had this issue and by deleting the org directory and rebuilding this solved the issue.

Lyndon
  • 21
  • 1
1
Using: Maven 3.0.5 required surefire:>2.10. 2.10 failed:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project robot-arm: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test failed: A required class was missing while executing org.apache.maven.plugins:maven-surefire-plugin:2.10:test: org/apache/maven/surefire/util/NestedCheckedException

2.11 works.
2.17 works.

Paul Verest
  • 60,022
  • 51
  • 208
  • 332
1

I got "unable to exe mojo" error when I build a maven project (JAVA), I noticed it also failed to get JAVA_HOME path which i added in my .batch_profile, manually export JAVA home problem resolved. it looks in many cases this build problem could happen but check system env variable might help ... David

0

I solved upgrading the plug in version in my pom.xml 1.17 failed 1.30.1 OK

PbxMan
  • 7,525
  • 1
  • 36
  • 40