Skip to content

Analyzing a project with Java 24 as a compilation target doesn't work #524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
seekM opened this issue Apr 25, 2025 · 3 comments · May be fixed by #528
Open

Analyzing a project with Java 24 as a compilation target doesn't work #524

seekM opened this issue Apr 25, 2025 · 3 comments · May be fixed by #528
Labels
bug Something isn't working

Comments

@seekM
Copy link

seekM commented Apr 25, 2025

Affected version

3.8.1

Bug description

Hello, thank you for enabling issues at Github, that makes it much easier to report them! Thank you also for maintainig this plugin!

Using the Maven Dependency Plugin to analyze a Maven project with Java 24 as a compilation target leads to the following error message:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.8.1:analyze (default-cli) [...]
Byte code of [...]: Unsupported class file major version 68

It works when using Java 23 as a compilation target. I also uploaded a minimal example to reproduce this here.

@Bukama
Copy link
Contributor

Bukama commented May 6, 2025

Can't help on the issue (except knowing that we have already fixed some of Java 24 problems in other parts, but I would like to thank you for the following sentence, showing us, that one of the goals of the migration is reached more and more

Hello, thank you for enabling issues at Github, that makes it much easier to report them!

@talios
Copy link

talios commented May 13, 2025

Would love to see this updated - looking at the projects pom.xml, I see this is likely fixed in maven-dependency-analyer, which had a recent release (last month), so updating <version>1.15.1</version> to <version>1.16.0</version> would likely resolve the issue.

However, updating that locally and building (under 24) gives me:

[ERROR] Failed to execute goal org.eclipse.sisu:sisu-maven-plugin:0.9.0.M3:main-index (index-project) on project maven-dependency-plugin: Execution index-project of goal org.eclipse.sisu:sisu-maven-plugin:0.9.0.M3:main-index failed: Problem scanning file:/Users/amrk/IdeaProjects/upstream/maven-dependency-plugin/target/classes/org/apache/maven/plugins/dependency/resolvers/OldResolveDependencySourcesMojo.class: Problem scanning jrt:/java.base/java/lang/Deprecated.class: Unsupported class file major version 68 -> [Help 1]

Building under 23 succeeds, then running mvn dependency:3.8.2-SNAPSHOT:analyze on my project passes.

I can raise a PR if desired, tho the change is just

diff --git i/pom.xml w/pom.xml
index 2cbae8d1..4013f229 100644
--- i/pom.xml
+++ w/pom.xml
@@ -217,7 +217,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-dependency-analyzer</artifactId>
-      <version>1.15.1</version>
+      <version>1.16.0</version>
     </dependency>
     <dependency>

talios added a commit to talios/maven-dependency-plugin that referenced this issue May 13, 2025
This commit updates the analyser version which supports reading byte
code generated by Java 24.

Fixes apache#524
@talios talios linked a pull request May 13, 2025 that will close this issue
6 tasks
@talios
Copy link

talios commented May 13, 2025

It looks like updating the analyzer works, but also fails one IT test, I'm unfamiliar with either code base but will try and see if I can spot whats changed/broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants