Solving the Infamous “Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.7.1:descriptor failed: Unsupported class file major version 66” Error
Image by Jove - hkhazo.biz.id

Solving the Infamous “Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.7.1:descriptor failed: Unsupported class file major version 66” Error

Posted on

If you’re reading this article, chances are you’ve stumbled upon the frustrating error message “Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.7.1:descriptor failed: Unsupported class file major version 66” while trying to build your Maven project. Don’t worry, you’re not alone! In this article, we’ll dive into the root cause of this error and provide a step-by-step guide to resolve it once and for all.

What’s behind the error message?

The error message itself doesn’t provide much insight, but let’s break it down:

Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.7.1:descriptor failed: 
Unsupported class file major version 66

The key phrase here is “Unsupported class file major version 66”. This indicates that the Java compiler is complaining about an incompatible class file version.

What is a class file major version?

In Java, every compiled class file contains metadata, including a major version number that indicates the Java version used to compile the class. This version number is stored in the class file header and is used by the Java Virtual Machine (JVM) to ensure compatibility.

In this case, the major version 66 refers to Java 12 and later versions. Yes, you read that right – Java 12 and later!

Why does this error occur?

The error occurs when your Maven project is configured to use a Java version that is older than Java 12, but the maven-plugin-plugin version 3.7.1 is compiled with a newer Java version (Java 12 or later). This mismatch causes the Java compiler to throw an “Unsupported class file major version” error.

There are a few scenarios where this error might occur:

  • You’re using an older Java version (e.g., Java 8 or 11) in your project, but the maven-plugin-plugin version 3.7.1 is compiled with Java 12 or later.
  • You’ve recently upgraded your Java version, but your Maven project is still configured to use an older version.
  • You’re using a third-party library or plugin that’s compiled with a newer Java version, causing the compatibility issue.

Resolving the error

To resolve this error, you’ll need to ensure that your Maven project is configured to use a compatible Java version. Here are the steps to follow:

Step 1: Check your Java version

First, make sure you’re running the correct Java version. You can check your Java version by running the following command in your terminal or command prompt:

java -version

This will display the Java version installed on your system. Take note of the version number.

Step 2: Update your Maven project configuration

Next, update your Maven project configuration to use a compatible Java version. You can do this by editing your pom.xml file.

Add the following configuration to your pom.xml file:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.12</source>
                <target>1.12</target>
            </configuration>
        </plugin>
    </plugins>
</build>

This configuration sets the Java source and target versions to 1.12, which is compatible with Java 12 and later versions.

Step 3: Update your Maven plugin versions

Make sure you’re using the latest versions of the Maven plugins. You can update your plugin versions by adding the following configuration to your pom.xml file:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-plugin-plugin</artifactId>
            <version>3.6.0</version>
        </plugin>
    </plugins>
</build>

This configuration updates the maven-plugin-plugin version to 3.6.0, which is compatible with Java 12 and later versions.

Step 4: Clean and build your project

Finally, clean and build your Maven project using the following commands:

mvn clean
mvn build

This will rebuild your project using the updated configuration.

Troubleshooting tips

If you’re still encountering issues, here are some additional troubleshooting tips:

  • Make sure you’ve updated your Maven version to the latest version.
  • Check for any other plugins or dependencies that may be causing compatibility issues.
  • Try building your project with a different Java version to isolate the issue.
  • Verify that your system’s Java version matches the version specified in your pom.xml file.

Conclusion

The “Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.7.1:descriptor failed: Unsupported class file major version 66” error can be frustrating, but it’s relatively easy to resolve once you understand the root cause. By following the steps outlined in this article, you should be able to resolve the error and get your Maven project building successfully again.

Remember to keep your Maven plugins and dependencies up-to-date, and always double-check your Java version and project configuration to avoid compatibility issues.

Java Version Major Version
Java 12 66
Java 11 55
Java 8 52

By understanding the class file major version and its implications on your Maven project, you’ll be better equipped to tackle compatibility issues and ensure a smooth build process.

Frequently Asked Question

Get clear explanations for the frustrating error “Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.7.1:descriptor failed: Unsupported class file major version 66” and get back to coding!

What does the error message “Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.7.1:descriptor failed: Unsupported class file major version 66” mean?

This error message indicates that the Maven Plugin Plugin (version 3.7.1) is trying to generate a plugin descriptor, but it’s encountering an unsupported class file format. Specifically, the major version of the class file is 66, which is not compatible with the plugin.

What is the main reason behind this error?

The primary cause of this error is a mismatch between the Java version used to compile the classes and the Java version used by the Maven Plugin Plugin. The plugin is not compatible with the Java 12 or later class file format, which has a major version of 56 or higher.

How can I fix this error?

To resolve this issue, you need to ensure that you’re using a compatible Java version. You can try compiling your classes with an earlier Java version (e.g., Java 8) or update the Maven Plugin Plugin to a version that supports the Java version you’re using. Additionally, make sure that your Maven configuration is set to use the correct Java version.

Can I use Java 12 or later with the Maven Plugin Plugin?

Unfortunately, the Maven Plugin Plugin (version 3.7.1) does not support Java 12 or later. You’ll need to use an earlier Java version or update to a newer version of the plugin that supports the Java version you’re using.

Are there any workarounds or alternative solutions?

If you’re unable to update the Maven Plugin Plugin or use an earlier Java version, you can try using alternative plugins or workarounds. For example, you can use the Maven Java Decompiler Plugin to decompile and recompile your classes with a compatible Java version. However, this approach might require additional configuration and customization.

Leave a Reply

Your email address will not be published. Required fields are marked *