Skip to content

Instantly share code, notes, and snippets.

@liminal
Created December 10, 2018 12:03
Show Gist options
  • Save liminal/f0735a3c826ee3c287541d8960f398fd to your computer and use it in GitHub Desktop.
Save liminal/f0735a3c826ee3c287541d8960f398fd to your computer and use it in GitHub Desktop.
The "I just want everything to be Java 8" root build.gradle additions
// Just add these to the root build.gradle of any project where
// you just want everything to be Java 8 by default
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin" == plugin.class.name
|| "com.android.build.gradle.LibraryPlugin" == plugin.class.name) {
project.android.compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment