When I type "mvn -version" on the command line, I get the following message

java.lang.ClassNotFoundException: org.apache.maven.cli.MavenCli at org.codehaus.plexus.classworlds. ass (ClassRealm.java:271) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm .java: 247) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm .java: 239) at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass (Launch er.java:144) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Laun cher.java:266) at org.codehaus.plexus .classworlds.launcher.Launcher.launch (Launcher.jav a: 229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (La uncher.java Tic15) at org.codehaus.plexus.classworlds.launcher.Launcher .main (Launcher.java: 356)

downloaded maven 3.2.5. environment variables are configured correctly.

  • @Sergey Isterin Docked the maven-embedder, but didn't help - Sined

2 answers 2

Check that the / lib folder in the mavena directory is not empty. Symptoms are very similar to what is described here https://stackoverflow.com/questions/10889445/maven-mvn-version-java-lang-classnotfoundexception

  • I read your link before writing here, the folder is not empty. Even pumped on purpose. - Sined
  • Then we check the setting of the environment variables - M2_HOME should look in the maven installation directory, for example C: \ Program Files \ maven \. In Path, you need to add a link to / bin, something like% M2_HOME% \ bin. In principle, these are all the actions that need to be performed in order for the maven to work. As a bonus, I can offer to verify that java itself is installed correctly and the necessary versions. - Astaroth

I had a jamb in variables, or% M2_HOME% does not work, or, if you have two versions of maven installed, it's better to simply write the full path to the path, for example C: \ Program Files \ maven \ bin;