Document runtime JVM configuration when building an image
Fixes gh-21478pull/27078/head
parent
0bc5c2ba8c
commit
e19443093d
@ -0,0 +1,23 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.springframework.boot' version '{gradle-project-version}'
|
||||||
|
}
|
||||||
|
|
||||||
|
bootJar {
|
||||||
|
mainClassName 'com.example.ExampleApplication'
|
||||||
|
}
|
||||||
|
|
||||||
|
// tag::env-runtime[]
|
||||||
|
bootBuildImage {
|
||||||
|
environment = [
|
||||||
|
"BPE_DELIM_JAVA_TOOL_OPTIONS" : " ",
|
||||||
|
"BPE_APPEND_JAVA_TOOL_OPTIONS" : "-XX:+HeapDumpOnOutOfMemoryError"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
// end::env-runtime[]
|
||||||
|
|
||||||
|
task bootBuildImageEnvironment {
|
||||||
|
doFirst {
|
||||||
|
bootBuildImage.environment.each { name, value -> println "$name=$value" }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
java
|
||||||
|
id("org.springframework.boot") version "{gradle-project-version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
// tag::env-runtime[]
|
||||||
|
tasks.getByName<BootBuildImage>("bootBuildImage") {
|
||||||
|
environment = mapOf(
|
||||||
|
"BPE_DELIM_JAVA_TOOL_OPTIONS" to " ",
|
||||||
|
"BPE_APPEND_JAVA_TOOL_OPTIONS" to "-XX:+HeapDumpOnOutOfMemoryError"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// end::env-runtime[]
|
||||||
|
|
||||||
|
tasks.register("bootBuildImageEnvironment") {
|
||||||
|
doFirst {
|
||||||
|
for((name, value) in tasks.getByName<BootBuildImage>("bootBuildImage").environment) {
|
||||||
|
print(name + "=" + value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue