cbeust / jcommander

Command line parsing framework for Java
Apache License 2.0
1.97k stars 334 forks source link

Build fails with Java 17 #548

Closed pgier closed 1 year ago

pgier commented 1 year ago

I'm using Java 17 (openjdk version "17.0.5" 2022-10-18) on macos, and when I try to run the default build, it fails with a Java module error:

> ./gradlew assemble
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x2f377c45) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x2f377c45

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 780ms
1 actionable task: 1 executed
pgier commented 1 year ago

I was able to fix this by updating the version of gradle that gradlew uses to run the build. I created PR #549 to address this.

mkarg commented 1 year ago

Thank you for reporting this issue. Measnwhile we are using a later Gradle version, so JCommander will build fine even on Java 20. :-)