spring boot使用不指定Maven parent pom来创建可执行的spring boot项目
项目描述
很多情况下通过指定spring的starter parent maven依赖实现继承所有parent的依赖和版本来创建一个可执行的spring boot项目,但是并不是每个人都喜欢从spring-boot-starter-parent POM继承来创建一个可执行的jar/war。
您可能有自己需要使用的公司级的标准的parent pom,或者您可能更喜欢显式声明所有的Maven配置。
在本代码中,我们将演示如何在没有parent pom的情况下使用Maven创建可执行jar/war。
运行环境
jdk8+IntelliJ IDEA+maven
项目技术(必填)
spring+spring boot
数据库文件(可选)
无
依赖包文件(可选)
maven搭建
链接:https://pan.baidu.com/s/1rBGMyqta8Pow5K33jOIAcQ
提取码:c6t3
是否原创(转载必填原文地址)
转载https://memorynotfound.com/spring-boot-create-executable-using-maven-without-parent-pom/
项目截图(必填)
运行截图(必填)
注意事项(可选)
1.通过在<dependencyManagement>标签中添加<type>pom</type><scope>import</scope>的依赖可以实现多重继承
dependencies即使在子项目中不写该依赖项,那么子项目仍然会从父项目中继承该依赖项(全部继承)
dependencyManagement里只是声明依赖,并不实现引入,因此子项目需要显示的声明需要用的依赖。如果不在子项目中声明依赖,是不会从父项目中继承下来的;只有在子项目中写了该依赖项,并且没有指定具体版本,才会从父项目中继承该项,并且version和scope都读取自父pom;另外如果子项目中指定了版本号,那么会使用子项目中指定的jar版本。
2.通过spring-boot-maven-plugin的repackage打包一个可执行的springboot jar包
猜你喜欢
- SpringBoot入门整合开发java Web项目实例
- Springboot+Mybatis+maven+layui开发简单的学习实例
- SpringBoot+vue前后端分离-模板项目,适合新手小白二次开发,太香了
- 基于Spring Boot、Layui和Mybatis-plus的后台管理系统脚手架项目
- mac下spring boot基础增删改查项目实例
- spring boot入门快速开发java web应用实例
- springboot demo小例子
- spring boot简单入门demo实例
- springboot+mybatis+Maven+jsp+Quartz整合实战林业厅项目
- IntelliJ IDEA下SpringBoot+Maven+Spring Data JPA+Layui整合实现增删改查及分页的单表项目实例
- SpringBoot项目,tk.mybatis通用mapper支持,shiro权限管理,以及mybatis分页插件,文件上传实例
- spring boot+jfinal的ActiveRecordPlugin重新整合林业厅会议系统
- /
- /executable-without-parent
- /executable-without-parent/pom.xml
- /executable-without-parent/src
- /executable-without-parent/src/main
- /executable-without-parent/src/main/java
- /executable-without-parent/src/main/java/com
- /executable-without-parent/src/main/java/com/memorynotfound
- /executable-without-parent/src/main/java/com/memorynotfound/springboot
- /executable-without-parent/src/main/java/com/memorynotfound
- /executable-without-parent/src/main/java/com
- /executable-without-parent/src/main/resources
- /executable-without-parent/src/main/resources/application.properties
- /executable-without-parent/src/main/java
- /executable-without-parent/src/main
- /executable-without-parent

- 证 Spring Boot创建自定义Banner.txt实例
- 证 Spring Boot配置@Profile注解加载不同环境的配置文件实例
- 证 Spring Boot Actuator 2.3.4.RELEASE新版本实现自定义端点信息的配置实例
- 原证 spring AOP 过滤器 拦截器 执行顺序示例
- 证 Spring Boot整合thymeleaf做为显示层的hello world实例
- 证 Spring Boot整合SpringFox Swagger2实现REST API增删改查项目实例
- 证 Spring Boot演示@ConfigurationProperties标注实现自定义配置属性的实例
- 证 Spring Boot整合Ehcache的简单入门实例
- 原 SpringBoot入门整合开发java Web项目实例
- 证 Spring Boot整合Freemarker实现文件上传项目实例
- 原证 Springboot+Mybatis+maven+layui开发简单的学习实例
- 证精 基于spring boot+spring data jpa+bootstrap的企业级进销存管理系统

