'determining java version used in gradle build

  • Complementary to this question: tell-gradle-to-use-specific-java-version
  • How can I determine (verify) the java version actually used in gradle build?
  • After a successful ./gradlew build, I looked for javac, but it was just in a binary file:
$ grep -rn "javac"
Binary file .gradle/4.6/taskHistory/taskHistory.bin matches
  • I have many java versions installed, so a mixup is possible.
  • Is there any way to verify the java version?


Solution 1:[1]

./gradlew --version will tell you which jdk version you are using.

Solution 2:[2]

If you add --info to the build command it will tell you what java exe it is using for the compile:

./gradlew build --info

Then look for the string Starting process and you will see a line like:

Starting process 'Gradle Worker Daemon 10'. Working directory: C:\dev\.gradle\workers Command: C:\dev\.jdks\corretto-11.0.13\bin\java.exe ...'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kaj Hejer
Solution 2