简体   繁体   中英

Start Spring Boot web application from Linux command line

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM