Spring Boot-如果您已经有父pom,则为父pom [英] Spring Boot - parent pom when you already have a parent pom

查看:82
本文介绍了Spring Boot-如果您已经有父pom,则为父pom的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有特定的推荐方法将spring-boot父pom包含到已经具有必需的父POM的项目中?

Is there a specific recommended approach to the inclusion of the spring-boot parent pom into projects that already have a required parent POM?

对于需要从组织上级扩展的项目,您有什么建议(这是非常普遍的,甚至很多/大多数项目根据它们来自的Feeder存储库发布到Maven Central).大多数构建工作都与创建可执行JAR相关(例如,运行嵌入式Tomcat/Jetty).有一些结构化方法的方法,这样您就可以获取所有依赖项而无需从父级扩展(类似于合成vs.继承).但是您无法以这种方式获得构建内容.

What do you recommend for projects that need to extend from an organizational parent (this is extremely common and even something many/most projects published to Maven central depending on the feeder repos they come from). Most of the build stuff is related to creating executable JARs (e.g. running embedded Tomcat/Jetty). There are ways to structure things so that you can get all the dependencies without extending from a parent (similar to composition vs. inheritance). You can't get a build stuff that way though.

因此,最好将所有spring-boot父pom包含在所需的父POM内,或者仅在项目POM文件中具有POM依赖项.

So is it preferable to include all of the spring-boot parent pom inside of the required parent POM or to simply have a POM dependency within the project POM file.

其他选项?

TIA,

斯科特

推荐答案

您可以像"bom"一样使用spring-boot-starter-parent (参见

You can use the spring-boot-starter-parent like a "bom" (c.f. Spring and Jersey other projects that support this feature now), and include it only in the dependency management section with scope=import.That way you get a lot of the benefits of using it (i.e. dependency management) without replacing the settings in your actual parent.

它做的其他2件事

  1. 定义一组属性以快速设置要覆盖的依赖项版本
  2. 使用默认配置(主要是Spring Boot maven插件)配置一些插件.因此,如果您使用自己的父母,那么您将必须手动执行这些操作.

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆