maven-dependency-plugin icon indicating copy to clipboard operation
maven-dependency-plugin copied to clipboard

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

Open seekM opened this issue 7 months ago • 3 comments

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.

seekM avatar Apr 25 '25 15:04 seekM

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!

Bukama avatar May 06 '25 04:05 Bukama

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 avatar May 13 '25 03:05 talios

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.

talios avatar May 13 '25 03:05 talios