spring boot 部署项目
-
导入相关依赖
<!--这个插件可以将应用打包成可执行的jar包--> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin>
-
等待依赖加载完成,使用maven完成打包
-
idea控制台打印结果
E:\Java\jdk1.8\bin\java -Dvisualvm.id=2676002024106 -Dmaven.multiModuleProjectDirectory=E:\idea文件\spring-boot\springboot01helloword -Xms256m -Xmx512m -Dfile.encoding=utf-8 -Dmaven.home=E:\apache-maven-3.5.2 -Dclassworlds.conf=E:\apache-maven-3.5.2\bin\m2.conf “-javaagent:E:\idea相关\IntelliJ IDEA 2017.3.6\lib\idea_rt.jar=52561:E:\idea相关\IntelliJ IDEA 2017.3.6\bin” -classpath E:\apache-maven-3.5.2\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.3.6 -s E:\apache-maven-3.5.2\conf\settings.xml package
[INFO] Scanning for projects…
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-boot01-helloword 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ spring-boot01-helloword —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ spring-boot01-helloword —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to E:\idea�ļ�\spring-boot\springboot01helloword\target\classes
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ spring-boot01-helloword —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\idea�ļ�\spring-boot\springboot01helloword\src\test\resources
[INFO]
[INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ spring-boot01-helloword —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-surefire-plugin:2.18.1:test (default-test) @ spring-boot01-helloword —
[INFO] No tests to run.
[INFO]
[INFO] — maven-jar-plugin:2.6:jar (default-jar) @ spring-boot01-helloword —
[INFO] Building jar: E:\idea�ļ�\spring-boot\springboot01helloword\target\spring-boot01-helloword-1.0-SNAPSHOT.jar
[INFO]
[INFO] — spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) @ spring-boot01-helloword —
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.738 s
[INFO] Finished at: 2019-11-02T13:20:12+08:00
[INFO] Final Memory: 27M/275M
[INFO] ------------------------------------------------------------------------
黑体字加粗部分是jar包的路径
- 运行jar包
(1)把jar包移到桌面上/移到一个你知道的文件夹下/或不移动
(2)使用管理员权限运行命令窗口 (win7可以使用windows+r 即可 /win10需手动调出cmd窗口的位置到桌面上。右键使用管理员权限)
(3)使用转盘命令e: 可转盘 cd 详细路径,建议复制 等等,移动到jar包对应的文件的上一层
(4)使用java -jar jar包名字 下面是我使用的命令 回车执行即可
java -jar spring-boot01-helloword-1.0-SNAPSHOT.jar
成功标志
一旦关闭命令提示符窗口服务器就关闭了
(5)测试项目接口
成功!