-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Option for light(er)weight packaging #1813
Comments
Hmm - Isn't that just a .jar? Just comment out the build plugin and do mvn dependency:copy-dependencies and then make sure the jar has those libs on the CLASSPATH. Or is hat last bit what you're after? |
Oooh - just looked at capsule. I dig it! That would be cool.. |
Interesting - what happens if some dependencies can't be resolved? But the idea is really interesting - you could also use that or automatic update checks at startup... |
How often are you NOT able to resolve an artifact? A good deal of time (on build) is due to config and/or networking. Yes, there is chance of a broken app (when dependencies aren't completely resolved), but isn't that something that a smoke test or test run after deployment would catch? I'm just thinking out loud here. |
Someone actually started a contribution for this (see https://github.com/patrikbeno/spring-boot/blob/MvnLauncher/spring-boot-docs/src/main/asciidoc/mvnlauncher.adoc). We had a brief email conversation and this was my response at the time: Providing on-demand download support is something that we have considered in the past and I think it is an interesting approach, however, I have a few reservations. My primary concern is that packaged applications become much more brittle when they need to download dependencies during production deployment. Do you find the larger self-contained JARs problematic? Is the main goal to reduce duplication by allowing multiple applications to share the same download cache? Does your operations team like the approach? I think it would be worth trying to find a way to support the |
I still feel that on-demand downloading is a risky thing to support out of the box. |
The actual problem caused with fat-JAR deployments is that — especially if the end of you CI pipeline installs the artifact into a repository — you basically accumulate a lot of artifacts that have other artifacts wrapped in them. Other artifacts that are actually also available in the repository. What if the resolution process was something to opt in via e.g. a command line flag and you could express that you might want to run the resolution against a well known local folder (e.g. |
In addition it would be great if such a |
I guess we' have to use means to invoke Maven (or I know that the actual list of dependencies could be precomputed so that the calculation doesn't have to be done at resolution time but even downloading manually those artifacts might cause issues with the artifact metadata (or we'd have to replicate the update of that metadata, which is even worse). |
Maybe I wasn't clear. I imagine When I start the application |
Where'd you store the packaged ZIP then? Wouldn't (that have to) be deployed into the repository, too? |
I'd extract it into the Docker base image. |
I had a look at this and threw together something that works. It could be tidied up a bit, but it seems like a useful direction: https://github.com/scratches/launcher. |
If we're going to do something with lighter weight packaging, @dsyer's thin launcher looks to be the way to go. Before we can consider making it part of Boot we need to get some feedback on it. So, if you're interested in this functionality, please check out what Dave has done and let us know how well it works for you. |
I've just added the thin launcher to a branch in Spring Restbucks. Very easy setup, works just fine. However, I couldn't get any output about what it's doing using the advertised command line flags and filed a ticket. |
Really nice work @dsyer! You considered and solved for quite a few more use cases than I had originally thought of. I will definitely recommend this packaging approach going forward. Seems like it should be baked into Spring Boot Maven Plugin rather than as a separate dependency. But I certainly understand why. I like that you can target a Maven repo with That said I see you can enable |
@fastnsilver I believe your |
Closing this one in favor of the thin jar launcher |
thin plugin is great, but, most of my projects are multi-module ones, I don't want to deploy the project modules to a private maven repository, is there any way I can pack the project-module jars into the thin jar? |
@jameshugit You'd have to raise a request at https://github.com/spring-projects-experimental/spring-boot-thin-launcher/issues |
Like spring-projects-experimental/spring-boot-thin-launcher#78 or spring-projects-experimental/spring-boot-thin-launcher#15 (ie no need for a new issue there). |
First of all Spring Boot is awesome. What might make it even more awesome? Have the Maven plugin package a .jar without all the dependencies; resolving them at first run. See https://github.com/puniverse/capsule. Perhaps Spring Boot could provide a flag for doing such?
The text was updated successfully, but these errors were encountered: