Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated Project.task() #45009

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spring-boot-project/spring-boot-devtools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dependencies {
testRuntimeOnly("io.r2dbc:r2dbc-h2")
}

task syncIntTestDependencies(type: Sync) {
tasks.register("syncIntTestDependencies", Sync) {
destinationDir = file(layout.buildDirectory.dir("dependencies"))
from {
configurations.intTestDependencies
Expand Down
20 changes: 10 additions & 10 deletions spring-boot-project/spring-boot-docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -230,38 +230,38 @@ task aggregatedJavadoc(type: Javadoc) {
}
}

task documentTestSlices(type: org.springframework.boot.build.test.autoconfigure.DocumentTestSlices) {
tasks.register("documentTestSlices", org.springframework.boot.build.test.autoconfigure.DocumentTestSlices) {
testSlices = configurations.testSlices
outputFile = layout.buildDirectory.file("generated/docs/test-auto-configuration/documented-slices.adoc")
}

task documentStarters(type: org.springframework.boot.build.starters.DocumentStarters) {
tasks.register("documentStarters", org.springframework.boot.build.starters.DocumentStarters) {
outputDir = layout.buildDirectory.dir("generated/docs/using/starters/")
}

task documentAutoConfigurationClasses(type: org.springframework.boot.build.autoconfigure.DocumentAutoConfigurationClasses) {
tasks.register("documentAutoConfigurationClasses", org.springframework.boot.build.autoconfigure.DocumentAutoConfigurationClasses) {
autoConfiguration = configurations.autoConfiguration
outputDir = layout.buildDirectory.dir("generated/docs/auto-configuration-classes/documented-auto-configuration-classes/")
}

task documentDependencyVersionCoordinates(type: org.springframework.boot.build.docs.DocumentManagedDependencies) {
tasks.register("documentDependencyVersionCoordinates", org.springframework.boot.build.docs.DocumentManagedDependencies) {
outputFile = layout.buildDirectory.file("generated/docs/dependency-versions/documented-coordinates.adoc")
resolvedBoms = configurations.resolvedBom
}

task documentDependencyVersionProperties(type: org.springframework.boot.build.docs.DocumentVersionProperties) {
tasks.register("documentDependencyVersionProperties", org.springframework.boot.build.docs.DocumentVersionProperties) {
outputFile = layout.buildDirectory.file("generated/docs/dependency-versions/documented-properties.adoc")
resolvedBoms = configurations.resolvedBom
}

task documentConfigurationProperties(type: org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {
tasks.register("documentConfigurationProperties", org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {
configurationPropertyMetadata = configurations.configurationProperties
outputDir = layout.buildDirectory.dir("generated/docs/application-properties")
}

task documentDevtoolsPropertyDefaults(type: org.springframework.boot.build.devtools.DocumentDevtoolsPropertyDefaults) {}
tasks.register("documentDevtoolsPropertyDefaults", org.springframework.boot.build.devtools.DocumentDevtoolsPropertyDefaults) {}

task runRemoteSpringApplicationExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
tasks.register("runRemoteSpringApplicationExample", org.springframework.boot.build.docs.ApplicationRunner) {
classpath = configurations.remoteSpringApplicationExample
mainClass = "org.springframework.boot.devtools.RemoteSpringApplication"
args = ["https://myapp.example.com", "--spring.devtools.remote.secret=secret", "--spring.devtools.livereload.port=0"]
Expand All @@ -271,7 +271,7 @@ task runRemoteSpringApplicationExample(type: org.springframework.boot.build.docs
normalizeLiveReloadPort()
}

task runSpringApplicationExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
tasks.register("runSpringApplicationExample", org.springframework.boot.build.docs.ApplicationRunner) {
classpath = configurations.springApplicationExample + sourceSets.main.output
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
args = ["--server.port=0"]
Expand All @@ -280,7 +280,7 @@ task runSpringApplicationExample(type: org.springframework.boot.build.docs.Appli
normalizeTomcatPort()
}

task runLoggingFormatExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
tasks.register("runLoggingFormatExample", org.springframework.boot.build.docs.ApplicationRunner) {
classpath = configurations.springApplicationExample + sourceSets.main.output
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
args = ["--spring.main.banner-mode=off", "--server.port=0", "--spring.application.name=myapp"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ test {
include "**/*Tests.class"
}

task testSliceMetadata(type: org.springframework.boot.build.test.autoconfigure.TestSliceMetadata) {
tasks.register("testSliceMetadata", org.springframework.boot.build.test.autoconfigure.TestSliceMetadata) {
sourceSet = sourceSets.main
outputFile = layout.buildDirectory.file("test-slice-metadata.properties")
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
implementation("org.springframework:spring-core")
}

task syncIntegrationTestSources(type: Sync) {
tasks.register("syncIntegrationTestSources", Sync) {
destinationDir = file(layout.buildDirectory.dir("it"))
from file("src/it")
filter(springRepositoryTransformers.ant())
Expand All @@ -39,7 +39,7 @@ processResources {
inputs.property "version", version
}

task integrationTest {
tasks.register("integrationTest") {
dependsOn syncIntegrationTestSources, jar
def resultsDir = file(layout.buildDirectory.dir("test-results/integrationTest"))
inputs.dir(file("src/it")).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("source")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies {
testImplementation("org.springframework:spring-test")
}

task fullJar(type: Jar) {
tasks.register("fullJar", Jar) {
dependsOn configurations.loader
archiveClassifier = "full"
entryCompression = "stored"
Expand Down Expand Up @@ -89,7 +89,7 @@ def configureArchive(archive) {
}
}

task zip(type: Zip) {
tasks.register("zip", Zip) {
archiveClassifier = "bin"
configureArchive it
}
Expand All @@ -98,14 +98,14 @@ intTest {
dependsOn zip
}

task tar(type: Tar) {
tasks.register("tar", Tar) {
compression = "gzip"
archiveExtension = "tar.gz"
configureArchive it
}

if (BuildProperties.get(project).buildType() == BuildType.OPEN_SOURCE) {
task homebrewFormula(type: org.springframework.boot.build.cli.HomebrewFormula) {
tasks.register("homebrewFormula", org.springframework.boot.build.cli.HomebrewFormula) {
dependsOn tar
outputDir = layout.buildDirectory.dir("homebrew")
template = file("src/main/homebrew/spring-boot.rb")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ gradlePlugin {
}
}

task preparePluginValidationClasses(type: Copy) {
tasks.register("preparePluginValidationClasses", Copy) {
destinationDir = layout.buildDirectory.dir("classes/java/pluginValidation").get().asFile
from(sourceSets.main.output.classesDirs) {
exclude "**/CreateBootStartScripts.class"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
apply plugin: 'io.spring.dependency-management'
// end::apply[]

task verify {
tasks.register("verify") {
doLast {
plugins.getPlugin(org.gradle.api.plugins.JavaPlugin.class)
plugins.getPlugin(io.spring.gradle.dependencymanagement.DependencyManagementPlugin.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repositories {
}
}

task slf4jVersion {
tasks.register("slf4jVersion") {
doLast {
println dependencyManagement.managedVersions['org.slf4j:slf4j-api']
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repositories {
}
}

task doesNotHaveDependencyManagement {
tasks.register("doesNotHaveDependencyManagement") {
def extensions = project.extensions
doLast {
if (extensions.findByName('dependencyManagement') != null) {
Expand All @@ -31,7 +31,7 @@ task doesNotHaveDependencyManagement {
}
}

task hasDependencyManagement {
tasks.register("hasDependencyManagement") {
doLast {
if (!dependencyManagement.managedVersions) {
throw new GradleException('No managed versions have been configured')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies {
implementation('org.jetbrains.kotlin:kotlin-stdlib-jdk8')
}

task kotlinVersion {
tasks.register("kotlinVersion") {
def properties = project.properties
doLast {
def kotlinVersion = properties.getOrDefault('kotlin.version', 'none')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'org.springframework.boot' version '{version}'
}

task kotlinVersion {
tasks.register("kotlinVersion") {
def properties = project.properties
doLast {
def kotlinVersion = properties.getOrDefault('kotlin.version', 'none')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

version = '0.1.0'

task buildInfo(type: org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
tasks.register("buildInfo", org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
properties {
artifact = 'foo'
group = 'foo'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ plugins {
id 'org.springframework.boot' version '{version}' apply false
}

task buildInfo(type: org.springframework.boot.gradle.tasks.buildinfo.BuildInfo)
tasks.register("buildInfo", org.springframework.boot.gradle.tasks.buildinfo.BuildInfo)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ plugins {
group = 'foo'
version = '0.1.0'

task buildInfo(type: org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
tasks.register("buildInfo", org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
excludes = ['group', 'artifact', 'version', 'name']
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ plugins {
id 'org.springframework.boot' version '{version}' apply false
}

task buildInfo(type: org.springframework.boot.gradle.tasks.buildinfo.BuildInfo)
tasks.register("buildInfo", org.springframework.boot.gradle.tasks.buildinfo.BuildInfo)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'org.springframework.boot' version '{version}' apply false
}

task buildInfo(type: org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
tasks.register("buildInfo", org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
excludes = ["time"]
properties {
artifact = 'example'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

version = '{projectVersion}'

task buildInfo(type: org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
tasks.register("buildInfo", org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
excludes = ["time"]
properties {
artifact = 'example'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ plugins {
id 'org.springframework.boot' version '{version}' apply false
}

task buildInfo(type: org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
tasks.register("buildInfo", org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
excludes = ["time"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ plugins {
id 'org.springframework.boot' version '{version}' apply false
}

task buildInfo(type: org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
tasks.register("buildInfo", org.springframework.boot.gradle.tasks.buildinfo.BuildInfo) {
excludes = ["time"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ dependencies {
implementation("org.springframework:spring-core:5.2.5.RELEASE")
}

task listLayers(type: JavaExec) {
tasks.register("listLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "list-layers"
}

task extractLayers(type: JavaExec) {
tasks.register("extractLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "extract", "--layers", "--launcher", "--destination", ".", "--force"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ dependencies {
implementation("org.apache.commons:commons-lang3:3.9")
}

task explode(type: Sync) {
tasks.register("explode", Sync) {
dependsOn(bootJar)
destinationDir = layout.buildDirectory.dir("exploded").get().asFile
from zipTree(files(bootJar).singleFile)
}

task launch(type: JavaExec) {
tasks.register("launch", JavaExec) {
classpath = files(explode)
mainClass = 'org.springframework.boot.loader.launch.JarLauncher'
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-logging:2.2.0.RELEASE")
}

task listLayers(type: JavaExec) {
tasks.register("listLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "list-layers"
}

task extractLayers(type: JavaExec) {
tasks.register("extractLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "extract", "--layers", "--launcher", "--destination", ".", "--force"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ dependencies {
implementation("org.springframework:spring-core:5.2.5.RELEASE")
}

task listLayers(type: JavaExec) {
tasks.register("listLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "list-layers"
}

task extractLayers(type: JavaExec) {
tasks.register("extractLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "extract", "--layers", "--launcher", "--destination", ".", "--force"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ dependencies {
implementation("org.springframework:spring-core:5.2.5.RELEASE")
}

task listLayers(type: JavaExec) {
tasks.register("listLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "list-layers"
}

task extractLayers(type: JavaExec) {
tasks.register("extractLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "extract", "--layers", "--launcher", "--destination", ".", "--force"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ dependencies {
implementation("org.springframework:spring-core:5.2.5.RELEASE")
}

task listLayers(type: JavaExec) {
tasks.register("listLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "list-layers"
}

task extractLayers(type: JavaExec) {
tasks.register("extractLayers", JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "extract", "--layers", "--launcher", "--destination", ".", "--force"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'org.springframework.boot' version '{version}'
}

task launch(type: JavaExec) {
tasks.register("launch", JavaExec) {
classpath = files(bootJar)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ dependencies {
implementation("org.springframework:spring-core:5.2.5.RELEASE")
}

task listLayers(type: JavaExec) {
tasks.register("listLayers", JavaExec) {
classpath = bootWar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "list-layers"
}

task extractLayers(type: JavaExec) {
tasks.register("extractLayers", JavaExec) {
classpath = bootWar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "extract", "--layers", "--launcher", "--destination", ".", "--force"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-logging:2.2.0.RELEASE")
}

task listLayers(type: JavaExec) {
tasks.register("listLayers", JavaExec) {
classpath = bootWar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "list-layers"
}

task extractLayers(type: JavaExec) {
tasks.register("extractLayers", JavaExec) {
classpath = bootWar.outputs.files
systemProperties = [ "jarmode": "tools" ]
args "extract", "--layers", "--launcher", "--destination", ".", "--force"
Expand Down
Loading