siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
712 stars 107 forks source link

Execution default of goal com.github.siom79.japicmp:japicmp-maven-plugin:0.11.0:cmp failed #303

Open dbl001 opened 2 years ago

dbl001 commented 2 years ago

I am trying to build Flink on OS X Monterey.

flink % java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12)
OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)
(base) davidlaxer@x86_64-apple-darwin13 flink % mvn -version
WARNING: Unknown module: ALL-UNNAME specified to --add-exports
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /opt/local/share/java/maven3
Java version: 17.0.1, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/openjdk17-temurin/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "11.1", arch: "x86_64", family: "mac"

I got this error running

$ mvn install
...
Execution default of goal com.github.siom79.japicmp:japicmp-maven-plugin:0.11.0:cmp failed: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null 

Here are the pom.xml dependencies in 'flink-metrics-core:

    <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.12</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.github.siom79.japicmp</groupId>
            <artifactId>japicmp-maven-plugin</artifactId>
            <version>0.15.2</version>
        </dependency>

Any ideas?

klaraward commented 2 years ago

I see the same thing with JDK 17.

martin-g commented 2 years ago

goal com.github.siom79.japicmp:japicmp-maven-plugin:0.11.0:cmp

Why does it say 0.11.0 ? When your pom.xml says 0.15.2

klaraward commented 2 years ago

I get [ERROR] Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.15.4:cmp (default) on project XYZ: Execution default of goal com.github.siom79.japicmp:japicmp-maven-plugin:0.15.4:cmp failed: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null -> [Help 1]

martin-g commented 2 years ago

There are several closed issues related to JAXB. You can check whether any of them solves your issue. Or try to create a simple application demonstrating the problem, so others can try to debug it!

dbl001 commented 2 years ago

I had already tried a few of the suggestions in the closed issues. I builds with no problems with JDK 1.8.

On Nov 15, 2021, at 5:51 AM, Martin Grigorov @.***> wrote:

There are several closed issues https://github.com/siom79/japicmp/issues?q=jaxb related to JAXB. You can check whether any of them solves your issue. Or try to create a simple application demonstrating the problem, so others can try to debug it!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/siom79/japicmp/issues/303#issuecomment-968930254, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXWFW3WBVUFAABL6O4HAC3UMEF7VANCNFSM5H232NEA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

klaraward commented 2 years ago

For me it worked better with export MAVEN_OPTS="--add-opens=java.base/java.lang=ALL-UNNAMED" when using JDK 17. (Still got an API incompatibility error though)

Actually, also moving to jaxb-runtime 2.3.5 in the dependencies for the japicmp plugin, like martin-g suggested (or the issues that was linked), did the trick for me.

dbl001 commented 2 years ago

I tried your suggestion in IntelliJ with JDK 17 and still got the same 8 errors. It works in JDK 1.8

On Nov 15, 2021, at 7:54 AM, Klara @.***> wrote:

For me it worked better with export MAVEN_OPTS="--add-opens=java.base/java.lang=ALL-UNNAMED" when using JDK 17. (Still got an API incompatibility error though)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/siom79/japicmp/issues/303#issuecomment-969050192, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXWFW5MGJMZVMNVUJYYGQ3UMEUMNANCNFSM5H232NEA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.