Which version of Maven is compatible with Java 6?

I need to work in an older project that requires java 6 to run, as there are links to the classes of the depreciable sun that were removed in future versions. As part of the process, I changed my jdk from 8 on my system path to point to java 6 jdk. After that I get:

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:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) 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) 

This is similar to Maven OSX Error Error Unsupported major.minor version 51.0 and Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0) however I am not looking for an update, I am looking to find a compatible maven version with java 6. Any ideas on which version is compatible and where can I download / install it from for mac?

+7
java maven maven-2
source share
2 answers

According to this page , the latest version of Maven that works with JDK1.6 is 3.2.5.

Note that it is better to continue to use the new version of Maven (and keep Java 8 as the default in the system path) and tell Maven that the project that it creates should compile with the original 1.6 package. See https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html for details. Reverting to old Maven will fix bug fixes / improvements for newer versions.

+12
source share

If you have a problem that you need to build using JDK 6, but you want to run Maven with JDK 7 (because you want to use Maven 3.3+), you should consider using a toolchain that makes this idea apart.

+1
source share

All Articles