-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring Boot use case: using spring-boot-loader
and classpath jar order
#2572
Comments
I imagine that if we were to support this, we'd go with an extension. (Part of the reason is explained in GoogleContainerTools/jib-extensions#31 (comment)).
@celcius112 unrelated to this issue, but we are very interested in making Jib work with JLink at this stage. I tried Jib on a JLink project (set up with Maven JLink plugin) a long time ago, and I remember I made it work with some workarounds and hacks. Other than that, we've not heard anything related to JLink from users. If you have an issue using Jib with JLink or any feedback, feel free to open a new issue. |
I'm just curious. Why do you expand file paths in And also we've heard a potential risk when listing all the dependencies on the command line, as some OSes may have a relatively short limit on command length (although I think in practice it's very rare to hit this issue unless you have hundreds of dependencies rooted deep in paths). |
Because we didn't know this feature existed in the JDK 😅 We shall read the classpath documentation a bit more carefully in the future (we rarely needed to until now), thanks for bringing that up.
No particular issues except some customization using There are a few small details here and there, but for the most part and our project it works like a charm for now. |
@chanseokoh Should we file this issue in https://github.com/GoogleContainerTools/jib-extensions instead? Or do the existing Spring Boot extensions address this usecase? |
The existing Spring Boot extension doesn't do anything about this issue. It is not unreasonable to special-case Spring Boot with an extension, so you can move this issue to jib-extensions if you want. However, we did commit to provide good experience for Spring Boot given the prevalence and importance of it, so currently we do have some special-case handling for Spring Boot. BTW, because classpath JAR ordering is stable for Java 9+ and it's now easy to extract Jib-computed classpath and main class, I think they are no longer a big deal in that aspect. What remains is about using |
I'll keep it here, but with the note that this should be implemented as an extension. |
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
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 GoogleContainerTools/jib-extensions#31 (comment)
The text was updated successfully, but these errors were encountered: