Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
72 views
in Technique[技术] by (71.8m points)

java - 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.

question from:https://stackoverflow.com/questions/65839131/start-spring-boot-web-application-from-linux-command-line

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...