gs-convert-jar-to-war
gs-convert-jar-to-war copied to clipboard
Converting a Spring Boot JAR Application to a WAR :: Learn how to convert your Spring Boot JAR-based application to a WAR file.
:toc: :icons: font :source-highlighter: prettify :project_id: gs-convert-jar-to-war :spring_boot_docs: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle
This repository is no longer maintained.
Spring Boot comes with two powerful plugins:
spring-boot-gradle-pluginspring-boot-maven-plugin
They both essentially have feature parity and provide the ability to run Spring Boot apps from the command line as well as bundle up runnable JARs. This subject is mentioned in almost every guide at the execution phase towards the end.
A popular subject is that many people still wish to generate WAR files to be deployed inside containers. Both of these plugins support that as well. Essentially, you have to reconfigure your project to produce a WAR file and declare the embedded container dependencies as "provided". This ensures that the relevant embedded container dependencies aren't included in the WAR file.
For detailed steps on how to configure your application to create a WAR file for your container, please see:
- {spring_boot_docs}/#build-tool-plugins-maven-packaging[Packaging executable jar and war files with Maven]
- {spring_boot_docs}/#build-tool-plugins-gradle-plugin[Spring Boot Gradle Plugin] or
- https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/html/#packaging-executable-wars[Gradle Plugin Reference: Packaging executable wars]
NOTE: Spring Boot operates on servlet 5.0 spec containers.
== See Also
The following guide may also be helpful:
- https://spring.io/guides/gs/spring-boot/[Building an Application with Spring Boot]
include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/footer.adoc[]