Use configuration avoidance APIs in Gradle plugin's docs
Closes gh-30056
This commit is contained in:
@@ -4,12 +4,12 @@ plugins {
|
||||
}
|
||||
|
||||
// tag::launch[]
|
||||
bootRun {
|
||||
tasks.named("bootRun") {
|
||||
optimizedLaunch = false
|
||||
}
|
||||
// end::launch[]
|
||||
|
||||
task optimizedLaunch {
|
||||
tasks.register("optimizedLaunch") {
|
||||
doLast {
|
||||
println bootRun.optimizedLaunch
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ plugins {
|
||||
}
|
||||
|
||||
// tag::launch[]
|
||||
tasks.getByName<BootRun>("bootRun") {
|
||||
tasks.named<BootRun>("bootRun") {
|
||||
isOptimizedLaunch = false
|
||||
}
|
||||
// end::launch[]
|
||||
|
||||
task("optimizedLaunch") {
|
||||
tasks.register("optimizedLaunch") {
|
||||
doLast {
|
||||
println(tasks.getByName<BootRun>("bootRun").isOptimizedLaunch)
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ plugins {
|
||||
}
|
||||
|
||||
// tag::main[]
|
||||
bootRun {
|
||||
tasks.named("bootRun") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
// end::main[]
|
||||
|
||||
task configuredMainClass {
|
||||
tasks.register("configuredMainClass") {
|
||||
doLast {
|
||||
println bootRun.mainClass
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ plugins {
|
||||
}
|
||||
|
||||
// tag::main[]
|
||||
tasks.getByName<BootRun>("bootRun") {
|
||||
tasks.named<BootRun>("bootRun") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
// end::main[]
|
||||
|
||||
task("configuredMainClass") {
|
||||
tasks.register("configuredMainClass") {
|
||||
doLast {
|
||||
println(tasks.getByName<BootRun>("bootRun").mainClass)
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ plugins {
|
||||
}
|
||||
|
||||
// tag::source-resources[]
|
||||
bootRun {
|
||||
tasks.named("bootRun") {
|
||||
sourceResources sourceSets.main
|
||||
}
|
||||
// end::source-resources[]
|
||||
|
||||
task configuredClasspath {
|
||||
tasks.register("configuredClasspath") {
|
||||
doLast {
|
||||
println bootRun.classpath.files
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ plugins {
|
||||
}
|
||||
|
||||
// tag::source-resources[]
|
||||
tasks.getByName<BootRun>("bootRun") {
|
||||
tasks.named<BootRun>("bootRun") {
|
||||
sourceResources(sourceSets["main"])
|
||||
}
|
||||
// end::source-resources[]
|
||||
|
||||
task("configuredClasspath") {
|
||||
tasks.register("configuredClasspath") {
|
||||
doLast {
|
||||
println(tasks.getByName<BootRun>("bootRun").classpath.files)
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ plugins {
|
||||
}
|
||||
|
||||
// tag::system-property[]
|
||||
bootRun {
|
||||
tasks.named("bootRun") {
|
||||
systemProperty 'com.example.property', findProperty('example') ?: 'default'
|
||||
}
|
||||
// end::system-property[]
|
||||
|
||||
task configuredSystemProperties {
|
||||
tasks.register("configuredSystemProperties") {
|
||||
doLast {
|
||||
bootRun.systemProperties.each { k, v ->
|
||||
println "$k = $v"
|
||||
|
||||
@@ -6,14 +6,14 @@ plugins {
|
||||
}
|
||||
|
||||
// tag::system-property[]
|
||||
tasks.getByName<BootRun>("bootRun") {
|
||||
tasks.named<BootRun>("bootRun") {
|
||||
systemProperty("com.example.property", findProperty("example") ?: "default")
|
||||
}
|
||||
// end::system-property[]
|
||||
|
||||
task("configuredSystemProperties") {
|
||||
tasks.register("configuredSystemProperties") {
|
||||
doLast {
|
||||
tasks.getByName<BootRun>("bootRun").systemProperties.forEach { k, v ->
|
||||
tasks.getByName<BootRun>("bootRun").systemProperties.forEach { k, v ->
|
||||
println("$k = $v")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user