【Maven异常】org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0]

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
	at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Follow the trail and check the maven version used by Eclipse

It was found that version 3.3.9 was used

Check the official website  http://maven.apache.org/download.cgi 

Found that this version requires minimum JDK 1.7

Continue to check that the jre version used by your own project is 1.6

When building this project, it was using 1.6, and running maven 3.3.9 requires at least 1.7 

Try to adjust the project to 1.7, the build is successful, and it is confirmed that this is the problem.

 

 solution 

The first:

Upgrade the project JRE version to 1.7 and above (via the Maven Compiler plugin)

The second:

Downgrade Maven version to 3.2 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326795546&siteId=291194637