jetty run mojo Unsupported major.minor version 51.0
The stack trace looked like this:
Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/jetty/maven/plugin/JettyRunMojo : 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:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.sonatype.guice.bean.reflect.URLClassSpace.loadClass(URLClassSpace.java:101)
... 41 more
It turns out that if you are compiling for java 6 and you use jetty maven plugin v9.x you will get this unsupported version error. This is because the jetty maven plugin for v9.0 or higher requires java 7.
So change your jetty maven plugin in your pom to use Jetty version 8.1 if you need to target java 6.
No comments:
Post a Comment