I am packaging my Spring Boot App with the Spring Boot gradle plugin.
tasks.bootBuildImage {
builder.set("paketobuildpacks/builder-jammy-full:latest")
imageName.set(devImageName)
val systemParams = listOf(
"-Dfile.encoding=UTF-8",
"-Djava.awt.headless=true",
"-Djava.net.preferIPv4Stack=true",
"-XX:-OmitStackTraceInFastThrow",
"-XX:+HeapDumpOnOutOfMemoryError"
)
val gcParams = listOf(
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseZGC",
"-XX:+UseLargePages",
"-XX:+DisableExplicitGC"
)
val allParams = (systemParams + gcParams).joinToString(" ")
environment.putAll(
mapOf(
"BPE_DELIM_JAVA_TOOL_OPTIONS" to " ",
"BPE_APPEND_JAVA_TOOL_OPTIONS" to allParams,
)
)
}
After building this image I run a lot of End-to-End Tests with Cypress and Playwright. this works fine. The App itself is started as a docker container together with all other needed components like Database, Loadbalancer and so on. so I can relay test the final setup. And Cypress/Playwright itself run as a docker container.
But now I want to measure code coverage.
How can I add the Jacoco Lib to the Spring Boot Image and let it only activate when a given property is set?
I found the Tanzu Jacoco Build Pack. Is this the right way?