Skip to content

Loading recipes fails on Java 24 due to ClassGraph's "enableMemoryMapping() is not supported on Java 24+" #5677

@Jiehong

Description

@Jiehong

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

<plugin>
        <groupId>org.openrewrite.maven</groupId>
        <artifactId>rewrite-maven-plugin</artifactId>
        <version>6.12.0</version>
        <configuration>
          <activeRecipes>
            <recipe>org.openrewrite.staticanalysis.NeedBraces</recipe>
          </activeRecipes>
        </configuration>
</plugin>

Does not matter which recipe.

What is the smallest, simplest way to reproduce the problem?

What did you expect to see?

No error message

What did you see instead?

Execution of goal org.openrewrite.maven:rewrite-maven-plugin:6.12.0:dryRun failed: enableMemoryMapping() is not supported on Java 24+

What is the full stack trace of any errors you encountered?

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution apply of goal org.openrewrite.maven:rewrite-maven-plugin:6.12.0:dryRun failed: enableMemoryMapping() is not supported on Java 24+
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:206)
    at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:71)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:545)
    at java.util.concurrent.FutureTask.run (FutureTask.java:328)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1095)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:619)
    at java.lang.Thread.run (Thread.java:1447)
Caused by: java.lang.IllegalArgumentException: enableMemoryMapping() is not supported on Java 24+
    at io.github.classgraph.ClassGraph.enableMemoryMapping (ClassGraph.java:1433)
    at org.openrewrite.config.ClasspathScanningLoader.scanYaml (ClasspathScanningLoader.java:128)
    at org.openrewrite.config.ClasspathScanningLoader.lambda$new$0 (ClasspathScanningLoader.java:64)
    at org.openrewrite.config.ClasspathScanningLoader.ensureScanned (ClasspathScanningLoader.java:222)
    at org.openrewrite.config.ClasspathScanningLoader.loadRecipe (ClasspathScanningLoader.java:210)
    at org.openrewrite.config.Environment.loadRecipe (Environment.java:210)
    at org.openrewrite.config.Environment.activateRecipes (Environment.java:162)
    at org.openrewrite.maven.AbstractRewriteBaseRunMojo.listResults (AbstractRewriteBaseRunMojo.java:125)
    at org.openrewrite.maven.AbstractRewriteDryRunMojo.execute (AbstractRewriteDryRunMojo.java:74)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:206)
    at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:71)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:545)
    at java.util.concurrent.FutureTask.run (FutureTask.java:328)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1095)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:619)
    at java.lang.Thread.run (Thread.java:1447)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions