springboot 项目部署

springboot内嵌tomcat,可以用jar包部署
1.在pom.xml中加入配置:

org.springframework.boot spring-boot-maven-plugin repackage

2.运行maven install
3.找到jar
4.将如下命令写成脚本start.sh:java -jar xxx.jar >nohup.out 2>&1&
nohupt.out是将标准输出日志打印到指定的文件nohup.out
2>&1输出所有的日志文件
5.执行脚本 ./start.sh

注意:如果用了thymeleaf,在th:include时候,如:th:include=“layout/layout :: layout” 不要写成:th:include="/layout/layout::layout",否则本地可以访问到,打成的jar包就会报找不到template的错误。

猜你喜欢

转载自blog.csdn.net/qq_21566775/article/details/86645392