当前位置:   article > 正文

SpringBoot使用maven打包项目_replacing main artifact with repackaged archive

replacing main artifact with repackaged archive

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目录,再安装到本地仓库。

--------------------------------------------------------------------------------------------------------------------------------

  1. [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ gateway ---
  2. [INFO] Changes detected - recompiling the module!
  3. [INFO] Compiling 1 source file to D:\java\HYYJ\gateway\target\test-classes
  4. [INFO]
  5. [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ gateway ---
  6. [INFO] Tests are skipped.
  7. [INFO]
  8. [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ gateway ---
  9. [INFO] Building jar: D:\java\HYYJ\gateway\target\gateway-0.0.1-SNAPSHOT.jar
  10. [INFO]
  11. [INFO] --- spring-boot-maven-plugin:2.3.7.RELEASE:repackage (repackage) @ gateway ---
  12. [INFO] Replacing main artifact with repackaged archive
  13. [INFO] ------------------------------------------------------------------------
  14. [INFO] BUILD SUCCESS
  15. [INFO] ------------------------------------------------------------------------
  16. [INFO] Total time: 15.115 s
  17. [INFO] Finished at: 2022-06-25T10:07:26+08:00
  18. [INFO] Final Memory: 29M/242M
  19. [INFO] ------------------------------------------------------------------------

然后就是根据自己打包项目的地址去获取jar包就可以了。

这是我的地址: D:\java\HYYJ\gateway\target\gateway-0.0.1-SNAPSHOT.jar

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/522469
推荐阅读
相关标签
  

闽ICP备14008679号