-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
Add support for creating layered war files with Gradle #22195
Comments
Thanks for the suggestion. Why do you want to use a war file rather than a jar file to create a Docker image? |
Is there anything wrong with using a Anyway, this is my use case: I have a webapp with thymeleaf. The following file structure works without any aditional configuration when using the war plugin: Until today, we alway execute If necessary, I could always download the .war artifact from the pipeline and run it locally. Since we work with microservice, setting up a development environment can be quite painful, so we use the I see two negative points if this layer feature only works with a .jar:
|
Thanks for the additional information. Generally speaking, the only reason to use a From your screenshot above, it looks as if you could switch to |
@wilkinsona You are completely right. I made these changes and everything worked as expected (with some adjustments to the thymeleaf settings). I'm sorry for the inconvenience. There is even documentation about it here: https://spring.io/guides/gs/serving-web-content/#_add_a_home_page |
Sorry for adding a comment into a already closed issue. We have a spring boot 2.3.2 application with jsps and so we have a war packaging. Is it possible to use the build-image goal? That would be a nice feature for us to reduce code and have the benefit of layered docker images until we get rid of the jsps. |
Not at the moment, no. Both layering and the build image goal are only supported with jar packaging. |
We are currently migration to Spring Boot 2.3.x and Docker for some of our projects and would love to use the layering to build our docker images. But as some of our products are deployed to customer servers and some of them have Docker (yet?) we would need to build the project as jar and war. Having just a war that we can deploy in any tomcat and build a layerd Docker image from would be awesome. |
Spring Boot 2.3 introduced a new feature where it is possible to create layered .jar files. This is very useful for docker images layer optimization as described in this blog post: https://spring.io/blog/2020/01/27/creating-docker-images-with-spring-boot-2-3-0-m1?#layered-jars
Unfortunately this doesn't work when generating a war file.
Take this
build.gradle
as an example:As soon as I add the
war
plugin I start to receive the following error when trying to use the layertools:The text was updated successfully, but these errors were encountered: