GoogleContainerTools / GoogleContainerTools/jib
Usage of Spring boot Gradle configuration name
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Spring Boot Gradle plugin has a special configuration `developmentOnly` which [affects only development classpath](https://docs.spring.io/spring-boot/gradle-plugin/packaging.html#packaging-executable.configuring.including-development-only-dependencies)
Currently:
* [JIB uses by default](https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#extended-usage) on `runtimeClasspath` configuration
* Jib has [a special Gradle extension](https://github.com/GoogleContainerTools/jib-extensions/tree/master/first-party/jib-spring-boot-extension-gradle) that seems (according to the documentation only covers "devtools") which is not enough
Spring defines a special Gradle configuration `productionRuntimeClasspath`, see [this comment](https://github.com/GoogleContainerTools/jib/issues/2336#issuecomment-849778769) for example.
This misaligned use causes issues in the production classpath which is hard to catch locally:
* locally we expect these dependencies to exist
* Spring disables them in tests so tests won't catch them too
Hence, the only way to catch them is to deploy the application.
Example issues:
* [Spring devtools are exposed in the container image classpath](https://github.com/GoogleContainerTools/jib/issues/2336)
* Docker compose from [spring-boot-docker-compose](https://docs.spring.io/spring-boot/reference/features/dev-services.html#features.dev-services.docker-compose) will be in the container runtime classpath too which is not expected and might cause issues (I got this issue)
* tl;dr **any dependency supposed to be used with `developmentOnly`* will be exposed**
Proposal options:
1. [Good option] Shall we, in case of Spring Boot apps, ("if spring boot") default it to `productionRuntimeClasspath`?
2. [No the best option] Shall the extension switch the configuration to `productionRuntimeClasspath`?
Contributor guide
Assessment
This issue has not been assessed yet.