0

Using Spring Boot, developed web application and running in Eclipse without any issues. I generated a WAR file using Maven build script. I would like to know, is it possible to start the Spring Boot using WAR file in Linux? If yes, what changes do I need to make. I have used JAR in the past to start the application, not WAR.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Chamu
  • 1
  • Does this answer your question? [How to start up spring-boot application via command line?](https://stackoverflow.com/questions/47835901/how-to-start-up-spring-boot-application-via-command-line) – Alexander Guyer Jan 22 '21 at 04:09

1 Answers1

2

WAR and JAR archive startup is quite different, as you can read in this answer.

However, if you use the build-image goal of the spring-boot-maven-plugin everything gets easier. This plugin creates a hybrid WAR/JAR file, that can be started with:

java -jar name_of_the_file.war

I tested with the version 2.3 of the plugin, but probably it works with earlier 2.x versions. Basically the plugin creates a wrapper that adds the libraries in WEB-INF/lib and WEB-INF/lib-provided to your classpath and calls your @SpringBootApplication class.

Piotr P. Karwasz
  • 12,857
  • 3
  • 20
  • 43