springboot的jar包方式
ps:打包前你的数据库相关的连接信息要记得修改,不能再用本地的了
第二步
:Maven clean :清除编译后的目录,默认是target目录
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cwgl 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ cwgl ---
[INFO] Deleting D:\FFM\cwgl\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.265 s
[INFO] Finished at: 2020-05-27T10:47:44+08:00
[INFO] Final Memory: 11M/121M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
第三步
: Maven package:打包
[INFO] --- maven-jar-plugin:3.1.0:jar (default-jar) @ cwgl ---
[INFO] Building jar: D:\FFM\cwgl\target\cwgl-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.1.RELEASE:repackage (repackage) @ cwgl ---
[INFO] Replacing main artifact with repackaged archive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.605 s
[INFO] Finished at: 2020-05-27T11:11:24+08:00
[INFO] Final Memory: 43M/272M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
第四步
:到target目录下找到 jar包
第五步
:将jar包放到linux的任意文件夹(可访问)下
第六步
:输入 java -jar 文件名.jar
ps:这样有一个问题就是当你终端关闭后,就不能访问了,或者说隔一段时间后就不能访问了
如何解决这个问题呢 ?使用nohup
nohup java -jar 文件名.jar &
1、nohup的意思不挂服务,常驻的意思,除非云服务器重启,那就没法了;
2、最后一个&表示执行命令后要生成日志文件nohup.out=
出现:nohup: ignoring input and appending output to ‘nohup.out’
正常情况,显目启动成功
检测:最后在浏览器地址栏输入项目地址,检查项目是否部署成功
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/qq_43842093/article/details/121942242
内容来源于网络,如有侵权,请联系作者删除!