6 changed files with 51 additions and 15 deletions
@ -1,19 +1,21 @@
@@ -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 @@
@@ -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