commit
2ba8b490a0
|
|
@ -7,7 +7,7 @@ plugins {
|
|||
apply(plugin = "io.spring.dependency-management")
|
||||
// end::apply[]
|
||||
|
||||
task("verify") {
|
||||
tasks.register("verify") {
|
||||
doLast {
|
||||
project.plugins.getPlugin(JavaPlugin::class)
|
||||
project.plugins.getPlugin(io.spring.gradle.dependencymanagement.DependencyManagementPlugin::class)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ the<DependencyManagementExtension>().apply {
|
|||
}
|
||||
}
|
||||
|
||||
task("slf4jVersion") {
|
||||
tasks.register("slf4jVersion") {
|
||||
doLast {
|
||||
println(project.the<DependencyManagementExtension>().managedVersions["org.slf4j:slf4j-api"])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::builder[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
builder = "mine/java-cnb-builder"
|
||||
runImage = "mine/java-cnb-run"
|
||||
}
|
||||
// end::builder[]
|
||||
|
||||
task bootBuildImageBuilder {
|
||||
tasks.register("bootBuildImageBuilder") {
|
||||
doFirst {
|
||||
println("builder=${tasks.bootBuildImage.builder}")
|
||||
println("runImage=${tasks.bootBuildImage.runImage}")
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::builder[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
builder = "mine/java-cnb-builder"
|
||||
runImage = "mine/java-cnb-run"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::buildpacks[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
buildpacks = ["file:///path/to/example-buildpack.tgz", "urn:cnb:builder:paketo-buildpacks/java"]
|
||||
}
|
||||
// end::buildpacks[]
|
||||
|
||||
task bootBuildImageBuildpacks {
|
||||
tasks.register("bootBuildImageBuildpacks") {
|
||||
doFirst {
|
||||
bootBuildImage.buildpacks.each { reference -> println "$reference" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::buildpacks[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
buildpacks = listOf("file:///path/to/example-buildpack.tgz", "urn:cnb:builder:paketo-buildpacks/java")
|
||||
}
|
||||
// end::buildpacks[]
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::caches[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
buildCache {
|
||||
volume {
|
||||
name = "cache-${rootProject.name}.build"
|
||||
|
|
@ -22,7 +22,7 @@ bootBuildImage {
|
|||
}
|
||||
// end::caches[]
|
||||
|
||||
task bootBuildImageCaches {
|
||||
tasks.register("bootBuildImageCaches") {
|
||||
doFirst {
|
||||
bootBuildImage.buildCache.asCache().with { println "buildCache=$name" }
|
||||
bootBuildImage.launchCache.asCache().with { println "launchCache=$name" }
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::caches[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
buildCache {
|
||||
volume {
|
||||
name = "cache-${rootProject.name}.build"
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::docker-auth-token[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
docker {
|
||||
builderRegistry {
|
||||
token = "9cbaf023786cd7..."
|
||||
|
|
@ -17,7 +17,7 @@ bootBuildImage {
|
|||
}
|
||||
// end::docker-auth-token[]
|
||||
|
||||
task bootBuildImageDocker {
|
||||
tasks.register("bootBuildImageDocker") {
|
||||
doFirst {
|
||||
println("token=${tasks.bootBuildImage.docker.builderRegistry.token}")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::docker-auth-token[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
docker {
|
||||
builderRegistry {
|
||||
token = "9cbaf023786cd7..."
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::docker-auth-user[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
docker {
|
||||
builderRegistry {
|
||||
username = "user"
|
||||
|
|
@ -20,7 +20,7 @@ bootBuildImage {
|
|||
}
|
||||
// end::docker-auth-user[]
|
||||
|
||||
task bootBuildImageDocker {
|
||||
tasks.register("bootBuildImageDocker") {
|
||||
doFirst {
|
||||
println("username=${tasks.bootBuildImage.docker.builderRegistry.username}")
|
||||
println("password=${tasks.bootBuildImage.docker.builderRegistry.password}")
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::docker-auth-user[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
docker {
|
||||
builderRegistry {
|
||||
username = "user"
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::docker-host[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
docker {
|
||||
host = "tcp://192.168.99.100:2376"
|
||||
tlsVerify = true
|
||||
|
|
@ -17,7 +17,7 @@ bootBuildImage {
|
|||
}
|
||||
// end::docker-host[]
|
||||
|
||||
task bootBuildImageDocker {
|
||||
tasks.register("bootBuildImageDocker") {
|
||||
doFirst {
|
||||
println("host=${tasks.bootBuildImage.docker.host}")
|
||||
println("tlsVerify=${tasks.bootBuildImage.docker.tlsVerify}")
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::docker-host[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
docker {
|
||||
host = "tcp://192.168.99.100:2376"
|
||||
isTlsVerify = true
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::env[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
environment = [
|
||||
"HTTP_PROXY" : "http://proxy.example.com",
|
||||
"HTTPS_PROXY": "https://proxy.example.com"
|
||||
|
|
@ -12,7 +12,7 @@ bootBuildImage {
|
|||
}
|
||||
// end::env[]
|
||||
|
||||
task bootBuildImageEnvironment {
|
||||
tasks.register("bootBuildImageEnvironment") {
|
||||
doFirst {
|
||||
bootBuildImage.environment.each { name, value -> println "$name=$value" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::env[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
environment = mapOf("HTTP_PROXY" to "http://proxy.example.com",
|
||||
"HTTPS_PROXY" to "https://proxy.example.com")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::env-runtime[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
environment = [
|
||||
"BPE_DELIM_JAVA_TOOL_OPTIONS" : " ",
|
||||
"BPE_APPEND_JAVA_TOOL_OPTIONS" : "-XX:+HeapDumpOnOutOfMemoryError"
|
||||
|
|
@ -16,7 +16,7 @@ bootBuildImage {
|
|||
}
|
||||
// end::env-runtime[]
|
||||
|
||||
task bootBuildImageEnvironment {
|
||||
tasks.register("bootBuildImageEnvironment") {
|
||||
doFirst {
|
||||
bootBuildImage.environment.each { name, value -> println "$name=$value" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::env-runtime[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
environment = mapOf(
|
||||
"BPE_DELIM_JAVA_TOOL_OPTIONS" to " ",
|
||||
"BPE_APPEND_JAVA_TOOL_OPTIONS" to "-XX:+HeapDumpOnOutOfMemoryError"
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::env[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
environment = ["BP_JVM_VERSION" : "8.*"]
|
||||
}
|
||||
// end::env[]
|
||||
|
||||
task bootBuildImageEnvironment {
|
||||
tasks.register("bootBuildImageEnvironment") {
|
||||
doFirst {
|
||||
bootBuildImage.environment.each { name, value -> println "$name=$value" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::env[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
environment = mapOf("BP_JVM_VERSION" to "8.*")
|
||||
}
|
||||
// end::env[]
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::image-name[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
imageName = "example.com/library/${project.name}"
|
||||
}
|
||||
// end::image-name[]
|
||||
|
||||
task bootBuildImageName {
|
||||
tasks.register("bootBuildImageName") {
|
||||
doFirst {
|
||||
println(tasks.bootBuildImage.imageName)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::image-name[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
imageName = "example.com/library/${project.name}"
|
||||
}
|
||||
// end::image-name[]
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::publish[]
|
||||
bootBuildImage {
|
||||
tasks.named("bootBuildImage") {
|
||||
imageName = "docker.example.com/library/${project.name}"
|
||||
publish = true
|
||||
docker {
|
||||
|
|
@ -22,7 +22,7 @@ bootBuildImage {
|
|||
}
|
||||
// end::publish[]
|
||||
|
||||
task bootBuildImagePublish {
|
||||
tasks.register("bootBuildImagePublish") {
|
||||
doFirst {
|
||||
println(tasks.bootBuildImage.publish)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::publish[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
tasks.named<BootBuildImage>("bootBuildImage") {
|
||||
imageName = "docker.example.com/library/${project.name}"
|
||||
isPublish = true
|
||||
docker {
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::classifiers[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
archiveClassifier = 'boot'
|
||||
}
|
||||
|
||||
jar {
|
||||
tasks.named("jar") {
|
||||
archiveClassifier = ''
|
||||
}
|
||||
// end::classifiers[]
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.Application'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::classifiers[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
archiveClassifier.set("boot")
|
||||
}
|
||||
|
||||
tasks.getByName<Jar>("jar") {
|
||||
tasks.named<Jar>("jar") {
|
||||
archiveClassifier.set("")
|
||||
}
|
||||
// end::classifiers[]
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.Application")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::custom-launch-script[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
launchScript {
|
||||
script = file('src/custom.script')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::custom-launch-script[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
launchScript {
|
||||
script = file("src/custom.script")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::include-launch-script[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
launchScript()
|
||||
}
|
||||
// end::include-launch-script[]
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::include-launch-script[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
launchScript()
|
||||
}
|
||||
// end::include-launch-script[]
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::launch-script-properties[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
launchScript {
|
||||
properties 'logFilename': 'example-app.log'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::launch-script-properties[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
launchScript {
|
||||
properties(mapOf("logFilename" to "example-app.log"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::layered[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
layered {
|
||||
application {
|
||||
intoLayer("spring-boot-loader") {
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::layered[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
layered {
|
||||
application {
|
||||
intoLayer("spring-boot-loader") {
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::layered[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
layered {
|
||||
enabled = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::layered[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
layered {
|
||||
isEnabled = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::layered[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
layered {
|
||||
includeLayerTools = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::layered[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
layered {
|
||||
isIncludeLayerTools = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::main-class[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
// end::main-class[]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::main-class[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
// end::main-class[]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::main-class[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
manifest {
|
||||
attributes 'Start-Class': 'com.example.ExampleApplication'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::main-class[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
manifest {
|
||||
attributes("Start-Class" to "com.example.ExampleApplication")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ dependencies {
|
|||
runtimeOnly('org.jruby:jruby-complete:1.7.25')
|
||||
}
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::requires-unpack[]
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
requiresUnpack '**/jruby-complete-*.jar'
|
||||
}
|
||||
// end::requires-unpack[]
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ dependencies {
|
|||
runtimeOnly("org.jruby:jruby-complete:1.7.25")
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::requires-unpack[]
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
requiresUnpack("**/jruby-complete-*.jar")
|
||||
}
|
||||
// end::requires-unpack[]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootWar {
|
||||
tasks.named("bootWar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ dependencies {
|
|||
}
|
||||
|
||||
// tag::include-devtools[]
|
||||
bootWar {
|
||||
tasks.named("bootWar") {
|
||||
classpath configurations.developmentOnly
|
||||
}
|
||||
// end::include-devtools[]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootWar>("bootWar") {
|
||||
tasks.named<BootWar>("bootWar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ dependencies {
|
|||
}
|
||||
|
||||
// tag::include-devtools[]
|
||||
tasks.getByName<BootWar>("bootWar") {
|
||||
tasks.named<BootWar>("bootWar") {
|
||||
classpath(configurations["developmentOnly"])
|
||||
}
|
||||
// end::include-devtools[]
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ plugins {
|
|||
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||
}
|
||||
|
||||
bootWar {
|
||||
tasks.named("bootWar") {
|
||||
mainClass = 'com.example.ExampleApplication'
|
||||
}
|
||||
|
||||
// tag::properties-launcher[]
|
||||
bootWar {
|
||||
tasks.named("bootWar") {
|
||||
manifest {
|
||||
attributes 'Main-Class': 'org.springframework.boot.loader.PropertiesLauncher'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ plugins {
|
|||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootWar>("bootWar") {
|
||||
tasks.named<BootWar>("bootWar") {
|
||||
mainClass.set("com.example.ExampleApplication")
|
||||
}
|
||||
|
||||
// tag::properties-launcher[]
|
||||
tasks.getByName<BootWar>("bootWar") {
|
||||
tasks.named<BootWar>("bootWar") {
|
||||
manifest {
|
||||
attributes("Main-Class" to "org.springframework.boot.loader.PropertiesLauncher")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::disable-jar[]
|
||||
jar {
|
||||
tasks.named("jar") {
|
||||
enabled = false
|
||||
}
|
||||
// end::disable-jar[]
|
||||
|
||||
bootJar {
|
||||
tasks.named("bootJar") {
|
||||
mainClass = 'com.example.Application'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::disable-jar[]
|
||||
tasks.getByName<Jar>("jar") {
|
||||
tasks.named<Jar>("jar") {
|
||||
enabled = false
|
||||
}
|
||||
// end::disable-jar[]
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
mainClass.set("com.example.Application")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ plugins {
|
|||
publishing {
|
||||
publications {
|
||||
bootJava(MavenPublication) {
|
||||
artifact bootJar
|
||||
artifact tasks.named("bootJar")
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
|
|
@ -19,7 +19,7 @@ publishing {
|
|||
}
|
||||
// end::publishing[]
|
||||
|
||||
task publishingConfiguration {
|
||||
tasks.register("publishingConfiguration") {
|
||||
doLast {
|
||||
println publishing.publications.bootJava
|
||||
println publishing.repositories.maven.url
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ plugins {
|
|||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("bootJava") {
|
||||
artifact(tasks.getByName("bootJar"))
|
||||
artifact(tasks.named("bootJar"))
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
|
|
@ -19,7 +19,7 @@ publishing {
|
|||
}
|
||||
// end::publishing[]
|
||||
|
||||
task("publishingConfiguration") {
|
||||
tasks.register("publishingConfiguration") {
|
||||
doLast {
|
||||
println(publishing.publications["bootJava"])
|
||||
println(publishing.repositories.getByName<MavenArtifactRepository>("maven").url)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::upload[]
|
||||
uploadBootArchives {
|
||||
tasks.named("uploadBootArchives") {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
repository url: 'https://repo.example.com'
|
||||
|
|
@ -14,7 +14,7 @@ uploadBootArchives {
|
|||
}
|
||||
// end::upload[]
|
||||
|
||||
task deployerRepository {
|
||||
tasks.register("deployerRepository") {
|
||||
doLast {
|
||||
println uploadBootArchives.repositories.mavenDeployer.repository.url
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ plugins {
|
|||
}
|
||||
|
||||
// tag::upload[]
|
||||
tasks.getByName<Upload>("uploadBootArchives") {
|
||||
tasks.named<Upload>("uploadBootArchives") {
|
||||
repositories.withGroovyBuilder {
|
||||
"mavenDeployer" {
|
||||
"repository"("url" to "https://repo.example.com")
|
||||
|
|
@ -14,13 +14,13 @@ tasks.getByName<Upload>("uploadBootArchives") {
|
|||
}
|
||||
// end::upload[]
|
||||
|
||||
val url = tasks.getByName<Upload>("uploadBootArchives")
|
||||
tasks.register("deployerRepository") {
|
||||
doLast {
|
||||
val url = tasks.getByName<Upload>("uploadBootArchives")
|
||||
.repositories
|
||||
.withGroovyBuilder { getProperty("mavenDeployer") }
|
||||
.withGroovyBuilder { getProperty("repository") }
|
||||
.withGroovyBuilder { getProperty("url") }
|
||||
task("deployerRepository") {
|
||||
doLast {
|
||||
println(url)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,12 +6,12 @@ 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 ->
|
||||
println("$k = $v")
|
||||
|
|
|
|||
Loading…
Reference in New Issue