cbeust / jcommander

Command line parsing framework for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails with Java 17

pgier opened this issue · comments

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

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.

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