Skip to content

Gradle DSL

bootstraponline edited this page Sep 20, 2019 · 2 revisions

Ignore exit code on exec task

Gradle

afterEvaluate {
    tasks.named("execFlank").configure {
        ignoreExitValue = true
    }
}

Gradle Kotlin DSL

# v1
tasks.named("execFlank", JavaExec::class.java).configure {
  setIgnoreExitValue(true)
}
# v2
tasks.named("execFlank", JavaExec::class.java).configure {
  isIgnoreExitValue = true
}
# v3
tasks.named<JavaExec>("execFlank").configure {
  isIgnoreExitValue = true
}

Java compatibility

Gradle

java {
  sourceCompatibility = JavaVersion.VERSION_12
  targetCompatibility = JavaVersion.VERSION_12
}

Gradle Kotlin DSL

tasks.withType<JavaCompile> {
    sourceCompatibility = JavaVersion.VERSION_12.toString()
    targetCompatibility = JavaVersion.VERSION_12.toString()
}

Clone this wiki locally