Hi, i have a few projects that are built on both linux and windows, and i was wondering if there is a way to have org.gradle.java.home be platform dependent.
What i’m ultimately trying to achieve is have the java version that a project is to be built with be specified and controlled in the project itself with a jdk path for both linux and windows and then have the right one chosen depending on the platform.
I know there is the option to pass it through the command line such as
but i would prefer if i didn’t have to do that as the user would need to know what version of java the project is compatible with.
Another option i’ve come across is to do
compileJava.options.fork = true
But it seems like i have to set the executable for different tasks such as Test, Javadoc, JavaExec, etc… and i could very easily miss one.
I could also modify gradlew and gradlew.bat of the project to use the appropriate java version but that change could easily be wiped away when the wrappers are regenerated. Unless there is a property i can specify to set the java version that the wrapper would use?
Any ideas/suggestions would be greatly appreciated. Thanks!