apache / apache/maven-surefire
Building a Java 8 toolchain project fails using JDK 9+ as JAVA_HOME
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
### Affected version
3.5.4
### Bug description
Surefire adds the `--add-opens` option, which is not supported by Java 8, to the Java command when Java 9 or later is used as the JAVA_HOME directory.
``
Command was cmd.exe /X /C ""C:\Program Files\Java\openjdk\j9\jdk8u472-b08\bin\java.exe" --add-opens java.base/java.lang=ALL-UNNAMED --enable-native-access=ALL-UNNAMED ....
``
When using JDK 8 as the JAVA_HOME directory, everything works fine because the `--add-opens` option is not used.
Contributor guide
Research direction
Reproduce a Java 8 toolchain project with JDK 9+ configured as JAVA_HOME and inspect how Surefire assembles the Java command. Verify the handling of --add-opens and --enable-native-access for the affected setup, then confirm the project builds successfully with appropriate regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100