A Maven build is failing with ERROR: Failed to parse POMs ... Unsupported major.minor version 51.0

Issue

  • A Maven build is failing with an error like
ERROR: Failed to parse POMs 
...
Caused by: java.lang.UnsupportedClassVersionError: org/apache/maven/eventspy/EventSpy : 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)
...

Environment

  • DEV@cloud
  • CloudBees Jenkins Enterprise
  • Jenkins
  • Maven

Resolution

Apache Maven 3.3.x requires a minimum of Java 7 and your build is configured to use Java 6.

Either install and configure your job to use a version of Maven < 3.3 or install and configure your job to use a version of JDK > 6 to solve the issue. The Configuration Slicing Plugin will help you to easily change the version of Apache Maven or the JDK used in several jobs in one step.

DEV@cloud specificity: By default you can find on your instance configuration a default Apache Maven installation called “Maven (latest)”. This one is available for testing purposes only and can be upgraded at any time. It is recommended to not use them for “production”. You should install your own version that you’ll control over the time to ensure the reproducibility and stability of your build.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.