finos / finos/TimeBase-CE

`gradlew` fails under java-17

Open
#235 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
132
Forks
23
Avg merge
3m
Merged PRs (30d)
1

Description

The documentation says java-11 is required. It would be helpful if `gradlew` checked the java version to make sure java-11 is being used. Java-17 is first on the path on my system, so `gradlew` failed:

```
$ ./gradlew help
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :buildSrc:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSrc:compileJava'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module
@0x6d3c3f0e) 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 @0x6d3c3f0e

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5s

$ java --version
openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+7-Ubuntu-0ubuntu122.04.2)
OpenJDK 64-Bit Server VM (build 17.0.7+7-Ubuntu-0ubuntu122.04.2, mixed mode, sharing)
```

A google search suggests java-17 ignores `compileJava.options.compilerArgs += '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'` in `java/build.gradle`.

As expected, it works if I use `JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ ./gradlew help`.

Contributor guide

Open the contributing guide

Research direction

Start by running ./gradlew help with Java 17 and then with JAVA_HOME set to Java 11 to reproduce the difference. Read gradlew and java/build.gradle, including the compileJava compiler arguments, and define the completed behavior as an explicit Java-version check that avoids the opaque failure when the required version is not active.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.