Fix configuration of environment in Kotlin bootBuildImage examples
Fixes gh-22913pull/22996/head
parent
5e5c1fb4d0
commit
f43a0b4891
@ -1,19 +1,21 @@
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootJar
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
|
||||
|
||||
plugins {
|
||||
java
|
||||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
mainClassName = "com.example.ExampleApplication"
|
||||
}
|
||||
|
||||
// tag::env[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
environment = [
|
||||
"HTTP_PROXY" : "http://proxy.example.com",
|
||||
"HTTPS_PROXY" : "https://proxy.example.com"
|
||||
]
|
||||
environment = mapOf("HTTP_PROXY" to "http://proxy.example.com",
|
||||
"HTTPS_PROXY" to "https://proxy.example.com")
|
||||
}
|
||||
// end::env[]
|
||||
|
||||
tasks.register("bootBuildImageEnvironment") {
|
||||
doFirst {
|
||||
for((name, value) in tasks.getByName<BootBuildImage>("bootBuildImage").environment) {
|
||||
print(name + "=" + value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,21 @@
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootJar
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
|
||||
|
||||
plugins {
|
||||
java
|
||||
id("org.springframework.boot") version "{gradle-project-version}"
|
||||
}
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
mainClassName = "com.example.ExampleApplication"
|
||||
}
|
||||
|
||||
// tag::env[]
|
||||
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||
environment = ["BP_JVM_VERSION" : "13.0.1"]
|
||||
environment = mapOf("BP_JVM_VERSION" to "13.0.1")
|
||||
}
|
||||
// end::env[]
|
||||
|
||||
tasks.register("bootBuildImageEnvironment") {
|
||||
doFirst {
|
||||
for((name, value) in tasks.getByName<BootBuildImage>("bootBuildImage").environment) {
|
||||
print(name + "=" + value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue