Search code examples
javamavenintellij-ideapom.xmlopenrewrite

org/openrewrite/maven/RewriteRunMojo : Unsupported major.minor version 52.0


I am using OpenRewrite on my project, in IntelliJ.

This is the maven configuration for the plugin

<plugin>
    <groupId>org.openrewrite.maven</groupId>
    <artifactId>rewrite-maven-plugin</artifactId>
    <version>5.8.1</version>
    <configuration>
        <activeRecipes>
            <recipe>org.openrewrite.java.migrate.UpgradeToJava11</recipe>
        </activeRecipes>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.openrewrite.recipe</groupId>
            <artifactId>rewrite-migrate-java</artifactId>
            <version>2.1.1</version>
        </dependency>
    </dependencies>
</plugin>

When I run the rewrite:run task, both by console and IntelliJ, it gives me this error

Execution default-cli of goal org.openrewrite.maven:rewrite-maven-plugin:5.8.1:run failed: Unable to load the mojo 'run' in the plugin 'org.openrewrite.maven:rewrite-maven-plugin:5.8.1' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/openrewrite/maven/RewriteRunMojo : Unsupported major.minor version 52.0

I've tried to change Java version, but with no results. I cannot find the problem.


Solution

  • I have found it.

    enter image description here

    Clicking with right and selecting "Modify Run Configuration"...

    enter image description here

    Change the setting from here to Java 8 solves the problem.