赞
踩
springboot项目默认的打包方式就是打jar包,因为它内嵌了tomcat,用不着打war包部署到tomcat的webapp目录下,安装了jdk,就可以直接运行
1:点击打开【Maven】界面。
2:点击【clean】清理一下项目
3:点击【package】打包项目
--------------------------------------------------------------------------------------------------------------------------------
1.maven clean。
清理项目的target目录
2.maven compile
编译项目
3.maven test
编译项目后,再执行Junit测试方法
4.maven package
编译项目后,再执行Junit测试方法,再把项目打包到target目录
5.maven install
编译项目后,再执行Junit测试方法,再把项目打包到target目录,再安装到本地仓库。
--------------------------------------------------------------------------------------------------------------------------------
- [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ gateway ---
- [INFO] Changes detected - recompiling the module!
- [INFO] Compiling 1 source file to D:\java\HYYJ\gateway\target\test-classes
- [INFO]
- [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ gateway ---
- [INFO] Tests are skipped.
- [INFO]
- [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ gateway ---
- [INFO] Building jar: D:\java\HYYJ\gateway\target\gateway-0.0.1-SNAPSHOT.jar
- [INFO]
- [INFO] --- spring-boot-maven-plugin:2.3.7.RELEASE:repackage (repackage) @ gateway ---
- [INFO] Replacing main artifact with repackaged archive
- [INFO] ------------------------------------------------------------------------
- [INFO] BUILD SUCCESS
- [INFO] ------------------------------------------------------------------------
- [INFO] Total time: 15.115 s
- [INFO] Finished at: 2022-06-25T10:07:26+08:00
- [INFO] Final Memory: 29M/242M
- [INFO] ------------------------------------------------------------------------
然后就是根据自己打包项目的地址去获取jar包就可以了。
这是我的地址: D:\java\HYYJ\gateway\target\gateway-0.0.1-SNAPSHOT.jar
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。