Skip to content

Support Java 25 #629

@shihyuho

Description

@shihyuho

Similar to #326, I would like to request support for Java 25.

<plugin>
  <groupId>org.cyclonedx</groupId>
  <artifactId>cyclonedx-maven-plugin</artifactId>
  <version>2.9.1</version>
  <configuration>
    <detectUnusedForOptionalScope>true</detectUnusedForOptionalScope>
  </configuration>
  <executions>
    <execution>
      <id>make-bom</id>
      <goals>
        <goal>makeBom</goal>
      </goals>
      <phase>generate-resources</phase>
    </execution>
  </executions>
</plugin>

Error output

[ERROR] Failed to execute goal org.cyclonedx:cyclonedx-maven-plugin:2.9.1:makeBom (make-bom) on project demo: Execution make-bom of goal org.cyclonedx:cyclonedx-maven-plugin:2.9.1:makeBom failed: Byte code of 'com.example.demo.DemoApplication' is corrupt from directory = /Users/matt/Downloads/demo/target/classes, path = /Users/matt/Downloads/demo/target/classes/com/example/demo/DemoApplication.class: Unsupported class file major version 69 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.cyclonedx:cyclonedx-maven-plugin:2.9.1:makeBom (make-bom) on project demo: Execution make-bom of goal org.cyclonedx:cyclonedx-maven-plugin:2.9.1:makeBom failed: Byte code of 'com.example.demo.DemoApplication' is corrupt from directory = /Users/matt/Downloads/demo/target/classes, path = /Users/matt/Downloads/demo/target/classes/com/example/demo/DemoApplication.class
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    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 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:565)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution make-bom of goal org.cyclonedx:cyclonedx-maven-plugin:2.9.1:makeBom failed: Byte code of 'com.example.demo.DemoApplication' is corrupt from directory = /Users/matt/Downloads/demo/target/classes, path = /Users/matt/Downloads/demo/target/classes/com/example/demo/DemoApplication.class
    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 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:565)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: java.lang.RuntimeException: Byte code of 'com.example.demo.DemoApplication' is corrupt from directory = /Users/matt/Downloads/demo/target/classes, path = /Users/matt/Downloads/demo/target/classes/com/example/demo/DemoApplication.class
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.acceptDirectory (ClassFileVisitorUtils.java:102)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.accept (ClassFileVisitorUtils.java:59)
    at org.apache.maven.shared.dependency.analyzer.asm.ASMDependencyAnalyzer.analyze (ASMDependencyAnalyzer.java:45)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.buildDependencyClasses (DefaultProjectDependencyAnalyzer.java:215)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.buildMainDependencyClasses (DefaultProjectDependencyAnalyzer.java:203)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.analyze (DefaultProjectDependencyAnalyzer.java:71)
    at org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer.analyze (ProjectDependencyAnalyzer.java:46)
    at org.cyclonedx.maven.CycloneDxMojo.doProjectDependencyAnalysis (CycloneDxMojo.java:98)
    at org.cyclonedx.maven.CycloneDxMojo.extractComponentsAndDependencies (CycloneDxMojo.java:130)
    at org.cyclonedx.maven.BaseCycloneDxMojo.execute (BaseCycloneDxMojo.java:336)
    [...]
Caused by: org.apache.maven.shared.dependency.analyzer.asm.VisitClassException: Byte code of 'com.example.demo.DemoApplication' is corrupt
    at org.apache.maven.shared.dependency.analyzer.asm.DependencyClassFileVisitor.visitClass (DependencyClassFileVisitor.java:97)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.visitClass (ClassFileVisitorUtils.java:120)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.visitClass (ClassFileVisitorUtils.java:112)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.acceptDirectory (ClassFileVisitorUtils.java:98)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.accept (ClassFileVisitorUtils.java:59)
    at org.apache.maven.shared.dependency.analyzer.asm.ASMDependencyAnalyzer.analyze (ASMDependencyAnalyzer.java:45)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.buildDependencyClasses (DefaultProjectDependencyAnalyzer.java:215)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.buildMainDependencyClasses (DefaultProjectDependencyAnalyzer.java:203)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.analyze (DefaultProjectDependencyAnalyzer.java:71)
    at org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer.analyze (ProjectDependencyAnalyzer.java:46)
    at org.cyclonedx.maven.CycloneDxMojo.doProjectDependencyAnalysis (CycloneDxMojo.java:98)
    at org.cyclonedx.maven.CycloneDxMojo.extractComponentsAndDependencies (CycloneDxMojo.java:130)
    at org.cyclonedx.maven.BaseCycloneDxMojo.execute (BaseCycloneDxMojo.java:336)
    [...]
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 69
    at org.objectweb.asm.ClassReader.<init> (ClassReader.java:200)
    at org.objectweb.asm.ClassReader.<init> (ClassReader.java:180)
    at org.objectweb.asm.ClassReader.<init> (ClassReader.java:166)
    at org.apache.maven.shared.dependency.analyzer.asm.DependencyClassFileVisitor.visitClass (DependencyClassFileVisitor.java:75)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.visitClass (ClassFileVisitorUtils.java:120)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.visitClass (ClassFileVisitorUtils.java:112)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.acceptDirectory (ClassFileVisitorUtils.java:98)
    at org.apache.maven.shared.dependency.analyzer.ClassFileVisitorUtils.accept (ClassFileVisitorUtils.java:59)
    at org.apache.maven.shared.dependency.analyzer.asm.ASMDependencyAnalyzer.analyze (ASMDependencyAnalyzer.java:45)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.buildDependencyClasses (DefaultProjectDependencyAnalyzer.java:215)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.buildMainDependencyClasses (DefaultProjectDependencyAnalyzer.java:203)
    at org.apache.maven.shared.dependency.analyzer.DefaultProjectDependencyAnalyzer.analyze (DefaultProjectDependencyAnalyzer.java:71)
    at org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer.analyze (ProjectDependencyAnalyzer.java:46)
    at org.cyclonedx.maven.CycloneDxMojo.doProjectDependencyAnalysis (CycloneDxMojo.java:98)
    at org.cyclonedx.maven.CycloneDxMojo.extractComponentsAndDependencies (CycloneDxMojo.java:130)
    at org.cyclonedx.maven.BaseCycloneDxMojo.execute (BaseCycloneDxMojo.java:336)
    [...]

Workaround:

  <plugin>
    <groupId>org.cyclonedx</groupId>
    <artifactId>cyclonedx-maven-plugin</artifactId>
    <version>2.9.1</version>
    <configuration>
      <detectUnusedForOptionalScope>true</detectUnusedForOptionalScope>
    </configuration>
    <dependencies>
      <dependency>
        <groupId>org.ow2.asm</groupId>
        <artifactId>asm</artifactId>
        <version>9.8</version>
      </dependency>
    </dependencies>
    <executions>
      <execution>
        <id>make-bom</id>
        <goals>
          <goal>makeBom</goal>
        </goals>
        <phase>generate-resources</phase>
      </execution>
    </executions>
  </plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions