Skip to content

Instantly share code, notes, and snippets.

@rivergod
Created April 26, 2019 03:49
Show Gist options
  • Select an option

  • Save rivergod/ee07014733d2f7ddd257c0210d349bac to your computer and use it in GitHub Desktop.

Select an option

Save rivergod/ee07014733d2f7ddd257c0210d349bac to your computer and use it in GitHub Desktop.
JDK fork per version - ~/.gradle/init.d/bootstrap.gradle
allprojects {
afterEvaluate {
def versions = [
'1.6' : "/usr/lib/jvm/zulu-6-amd64/jre/lib/",
'1.7' : "/usr/lib/jvm/zulu-7-amd64/jre/lib/",
'1.8' : "/usr/lib/jvm/zulu-8-amd64/jre/lib/"
]
// convert map to classpaths
versions = versions.collectEntries { key, value ->
[key, fileTree(dir: value, include: "*.jar")]
}
def apply = { task ->
if (versions.containsKey(task.targetCompatibility))
{
task.options.fork = true;
task.options.bootstrapClasspath = versions[task.targetCompatibility]
}
}
tasks.withType(JavaCompile, apply)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment