GoogleContainerTools / GoogleContainerTools/jib
Spring Boot use case: using `spring-boot-loader` and classpath jar order
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Thank you @chanseokoh for this thorough and well written explanation ! You've made clear, precise and wise points that have changed my mind :).
We are using Jib with Spring Boot (and JLink, but that's another topic) and are very happy with it. Please continue the good work.
As you say at one point it might be useful to have this kind of capability. One case where I think it might be useful is when defining our own entrypoint. When that happens we need to define ourself the java execution command, something like
```
# Retrieve the files present in the /app/libs directory before subsequently joining them with a ':'
LIBS=/app/libs/*
exec java ${JAVA_OPTS} -cp /app/resources:/app/classes:${LIBS/ /:} ${MAIN_CLASS}
```
In that case I think the spring-boot-loader might do a better job than us, since it will handle the classpath and the main class for us.
Also, although I'm not sure if it's significant, Spring Boot now creates a `classpath.idx` file providing the ordering that jars should follow when added to the classpath. At one point it might be a good idea to follow what is written in that file.
_Originally posted by @celcius112 in https://github.com/GoogleContainerTools/jib-extensions/pull/31#issuecomment-655584059_
Contributor guide
Assessment
This issue has not been assessed yet.