-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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
Enhancements for new LAYERED_JAR layout in spring-boot-maven-plugin #20245
Comments
@aritzbastida Thank you for trying out the Spring Boot milestone and providing feedback. I'll try to speak to some of the points you've mentioned above. For layer customization, this is something we are planning to support. It is listed as one of the items in the original issue. Regarding skipping packaging of the fat jar for layered support, this is something we had considered. This reply from @wilkinsona on the blog post addresses why we think layering the jar has advantages. Indeed the concise docker file is a benefit to the approach you suggested. When it comes to generating a Dockerfile, we don't think we want to do this in Spring Boot because we think the Dockerfile will be customized more often than not and there are things to consider such as choosing the right base image. This is something we think is a use case more suited to start.spring.io. Flagging for team attention so that we can discuss this on our team call since it is something that has come up before. |
In the context of Spring Boot features, "buildpacks" refers to Cloud Native Buildpacks. This is very different from the "legacy" buildpack support in Cloud Foundry and Heroku you might be thinking of, as it is designed around container standards and OCI images. While Cloud Foundry and Heroku initiated and support CNB, Kubernetes-native tools like Tekton are building support for CNB also. |
First of all, thank you for the quick reply and attention to this issue. I now understand the benefits pointed out by @wilkinsona, regarding the LAYERED_JAR format. I think that the confusion with Layered Jars comes from the fact that it might be used in two different use cases: builder images (such as Openshift S2I) and custom Dockerfiles. So, to sum it up, there are three different use cases:
For this 3rd use case, maybe it would suffice to provide a "exploded" attribute in "repackage" goal in order to have a simpler Dockerfile. I think that the default generation of Dockerfile would still be convenient, which could be customized or even provided by the user as in maven-assemply-plugin . After all, Spring Boot is opinionated and with the Buildpack it is no different, which uses "cloudfoundry/cnb:0.0.43-bionic" as base image. |
Thanks for the feedback. We've discussed some more today.
Not necessarily. If your arrangement is to only use the image, you can configure the plugin's
You can configure the
We've discussed the option of having an "in place" goal that would generate an exploded structure rather than creating an archive. We've decided not to explore this route at this point as dealing with incremental changes of an exploded structure is quite tricky to get right. And if it doesn't work properly and you have to invoke
It would when you are getting started yes. Considering we're not keen to offer options to customize this "default" dockerfile, I don't think we should do that. Once you have your docker file in your project with your customizations, having this default generated is more annoying than anything else. Maybe there are other options we can investigate to help the getting started experience though. We are going to create separate issues for the layer customizations. |
Ok, understood your points. I guess we can close the issue. Just some final observations about "mvn deploy":
Yes, but with attach=false, Maven would still deploy the primary artifact (JAR/WAR produced by default-jar/default-war executions).
Yes, you can skip deploying individual modules within a multi-module, but not individual artifacts within the same module. In this use case, we would deploy Spring Cloud Contract stubs to the Maven repo (used as dependencies by other services), but not the "main" artifact, which is built as an image and deployed to the Docker registry. Not a big issue, really. I just noticed the difference between build-image and layered jars (first one is independent and second one depends on previous package), even if the intent is the same. |
Thanks for the feedback.
Yes, you mentioned that already and there isn't anything we can do about that.
It doesn't have to be the main artifact and the image isn't a maven artifact at all at the moment. We have plans to include a way to deploy to a docker registry but it's not implemented yet. As for the I am going to close this now as you suggested. We have created issues to custimize layers in both Maven and Gradle. Thanks again for the feedback. |
I've read the blog post regarding the new Docker-related features in the upcoming Spring Boot 2.3 Maven plugin. They are very interesting!
In our company, we are using Openshift, so I guess we cannot use Buildpacks. As far as I know, these are for Cloud Foundry and Heroku mainly. Please correct me if I'm wrong.
So, we would use Layered Jars. For these, I'd like to propose some enhancements, if you are open to suggestions (considering it's still in M2):
All in all, I think this behavior would be more intuitive and more aligned with the potential use cases. What do you think?
The text was updated successfully, but these errors were encountered: