在IDEA中如何将Spring boot项目打包成可执行的jar包
步骤1:
File->Project Structure

步骤2:
Project Settings->Artifacts->JAR->From modules with dependencies

步骤3:
选择启动类->OK

步骤4:
copy to the output directory and link via manifest->OK

步骤5:
Apply->OK

步骤6:
Build->Build Artifacts

步骤7:
demo01.jar->Build

步骤8:
<1>首次部署当前程序需要在对应的文件夹中执行以下命令
a.启动程序 nohup java -jar demo01.jar &
b.退出 ctrl + c
c.查看日志 tail -500f nohup.out
<2>非首次部署当前程序需要在对应的文件夹中执行以下命令
a.捕获上一个版本程序的进程 ps - ef|grep demo01.jar
b.杀死对应的进程 kill 进程号
c.启动程序 nohup java -jar demo01.jar &
d.退出 ctrl + c
e.查看日志 tail -500f nohup.out

浙公网安备 33010602011771号