Due to different servers running different JVM version. I would like to set a specific project to specific JDK version. I'm thinking may be setting JAVA_HOME with a task which compilation depends on it, but I'm not sure how to code it yet. But then there may be a simple setting I can do in build.gradle for that!?
I think you are after sourceCompatibility
and targetCompatibility
. Settings those on a project has - as far as compilation is concerned - the same effect than -source
and -target
parameters to javac
. If you need different settings for different compile tasks in one project, even that would be possible.