SONARIAC-2775 Fix Docker build on Java 21#111
Conversation
In Java 21 there is a change in JDK around starting new processes, the PATH environment variable is not taken into account. This PR fix it.
|
Example usage: https://github.com/SonarSource/sonar-iac-enterprise/pull/912 |
SummaryThis PR works around a Java 21 change where process creation no longer respects the PATH environment variable. The fix adds a What reviewers should knowStart here: Look at the new Then review: How it's applied in the two gradle scripts — one for running Key points for reviewers:
|
SummaryAdds explicit PATH resolution for executables to work around a Java 21 issue where process creation doesn't properly inherit the PATH environment variable. The new What reviewers should knowStart by reviewing the new
|
SummaryJava 21 changed process creation to not automatically resolve executables from the PATH environment variable. This PR adds a What reviewers should knowStart with the new
|
gradle-modules/src/main/kotlin/org/sonarsource/cloudnative/gradle/BuildUtils.kt
Outdated
Show resolved
Hide resolved
gradle-modules/src/main/kotlin/org/sonarsource/cloudnative/gradle/BuildUtils.kt
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Conclusion: Clean, targeted fix. The findExecutable() implementation is correct — proper PATH splitting, isFile && canExecute() check, Windows extension handling, and safe fallback. Executable paths are resolved at configuration time and captured in vals before task registration, which is the right pattern. No issues found.




In Java 21 there is a change in JDK around starting new processes, the PATH environment variable is not taken into account. This PR fix it.