20

如何运行Spring Boot项目

 4 years ago
source link: http://www.cnblogs.com/eaglelihh/p/13198485.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

背景

帮别人指导一个Spring Boot项目,它在本地把项目push到git服务器上,然后在部署的服务器上把代码pull下来(我猜应该是这个流程)

然后他问我这项目怎么运行?

我当时就懵了,因为我平时都是用IDEA直接run的

探索

于是查看了Spring Boot官网的文档,发现在一开始就介绍了此部分

首先需要有Java环境和Maven环境(如果是基于Maven构建的话)

第一种方案就是直接用此命令 mvn spring-boot:run

第二方案是先打包 mvn package 然后使用此命令 jar tvf target/myproject-0.0.1-SNAPSHOT.jar

疑问

在第二种方案中,我有点不清楚的是,在官方文档的Spring Boot start中,说要添加依赖 spring-boot-maven-plugin ,才能打包

但是我在实际实验中,不添加此依赖,也是可以打包的,所以这是为什么呢?

麻烦清楚的大佬在评论区告知一下,不胜感激!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK