Prevent eager creation of bootWar task

Previously, querying the artifact's extension in
SinglePublishedArtifact would result in eager creation of the task
that creates the artifact. Typically, this is the bootWar task.

Instead of querying the extension, this commit reworks
SinglePublishedArtifact and its callers to call separate methods for
jar and war artifacts so that the extension check is no longer
required.

Tests have been added to ensure that running help does not trigger
any unexpected task creation. The tests' assertions tolerate some
variation in behavior that depend on the version of Gradle and
whether the configuration cache is enabled.

Closes gh-30211
This commit is contained in:
Andy Wilkinson
2022-03-15 12:51:01 +00:00
parent 75693c1a00
commit f11ddb4bd7
12 changed files with 165 additions and 13 deletions

View File

@@ -0,0 +1,9 @@
plugins {
id 'org.springframework.boot' version '{version}'
id 'java'
id 'application'
}
tasks.configureEach {
println "Configuring ${it.path}"
}

View File

@@ -0,0 +1,8 @@
plugins {
id 'org.springframework.boot' version '{version}'
id 'java'
}
tasks.configureEach {
println "Configuring ${it.path}"
}

View File

@@ -0,0 +1,9 @@
plugins {
id 'org.springframework.boot' version '{version}'
}
apply plugin: 'org.jetbrains.kotlin.jvm'
tasks.configureEach {
println "Configuring ${it.path}"
}

View File

@@ -0,0 +1,8 @@
plugins {
id 'org.springframework.boot' version '{version}'
id 'war'
}
tasks.configureEach {
println "Configuring ${it.path}"
}