Closed serpro69 closed 3 months ago
This is because we're now recognising the configuration in the root build.gradle.kts
file to compile against Java 8. The best way to override this is to use a setup-java
step to install the JDK version that your project requires.
Hi @smowton , Thanks for the reply!
I've tried adding setup-java
step actually. The thing is, as mentioned above, I need several java versions, e.g. 8 and 11 to build the whole project, due to some gradle plugins compatibility nonsense. And if I install several versions with setup-java
, the action still defaults to java8.
Tricky. How about installing both, but then twiddling ~/.m2/toolchains.xml
to only list Java 11? I think Gradle will still find Java 8 by exploring the platform default JDK directory.
Hmm, let me try that :) Thanks for the suggestion.
OK, what I tried now is just to setup only one java version via setup-java
, instead of multiple, and that worked for my case. Codeql recognized the installed java version and didn't default to java 8, at the same time, the gradle plugin which requires me to have java 11+ also didn't complain. Don't know why I didn't try this earlier... But thanks for your suggestions @smowton . Closing this.
I have a multi-module kotlin project, where modules require different java versions (8, 11, ...) I noticed that my codeql actions started failing and since I haven't made any changes to build configuration between last successful build and currently failed one, I've started looking at the version of the action. While I can't spot anything in the logs, the last version that worked for me was codeql-cli-2.17.3, and after setting that up explicitly the build works again. With the current codeql-cli-2.17.6 , the build breaks with the following error:
This is a successful run after downgrading the codeql tooling to 2.17.3 and using
github/codeql-action/init@v3.25.6
version explicitly - https://github.com/serpro69/kotlin-faker/actions/runs/9724606568 If I useinit@v3
and do not set tool version, which currently defaults to 2.17.6, the build fails to compile due to java version that is being picked up: https://github.com/serpro69/kotlin-faker/actions/runs/9724530099/job/26840837224The problem is, with the current version, it's setting java8 by default, for some reason - https://github.com/serpro69/kotlin-faker/actions/runs/9724530099/job/26840837224#step:5:81 , and I do not see a way how to override that. That wasn't the case previously, so gradle would just pick whichever version is needed, based on toolchains and gradle setup.
Is this intended behavior? Is there any way I can upgrade to latest version while preserving the previous behavior?