一. 打包
1.1 对要部署的项目,右击—>Run As —>Maven clean,结果如下:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 1.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ demo ---
[INFO] Deleting F:\lee\springboot_demo\demo\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.781 s
[INFO] Finished at: 2018-08-15T16:16:57+08:00
[INFO] Final Memory: 6M/155M
[INFO] ------------------------------------------------------------------------
1.2 选中要部署的项目 右击 —> Run As —> Maven install,结果如下:
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ demo ---
[INFO] Building jar: F:\lee\springboot_demo\demo\target\demo-1.0.1.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.14.BUILD-SNAPSHOT:repackage (default) @ demo ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ demo ---
[INFO] Installing F:\lee\springboot_demo\demo\target\demo-1.0.1.jar to D:\devtools\newRepository\com\example\demo\1.0.1\demo-1.0.1.jar
[INFO] Installing F:\lee\springboot_demo\demo\pom.xml to D:\devtools\newRepository\com\example\demo\1.0.1\demo-1.0.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.605 s
[INFO] Finished at: 2018-08-15T16:25:41+08:00
[INFO] Final Memory: 38M/292M
[INFO] ------------------------------------------------------------------------
二. 上传jar包到服务区
2.1 使用Xftp上传还活着使用命令上传
三. 启动jar包
3.1 首先查看该端口下的进程
netstat -lanp|grep 端口号
3.2 杀掉该进程
kill -9 进程号
3.3 启动jar包
nohup java -jar demo-1.0.1.jar >springboot.log 2>&1 &
3.4 查看日志
tail -f springboot.log
3.5 在浏览器地址栏输入项目地址,访问项目检查是否部署成功