6.5. 融合 BOM 文件


要将 BOM 文件合并到 Maven 项目中,请在项目的 pom.xml 文件中指定一个 dependencyManagement 元素(或者在父 POM 文件中,如 Spring Boot 2 的示例中所示:

Spring Boot 2 BOM

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project ...>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- configure the versions you want to use here -->
    <fuse.version>7.11.1.fuse-sb2-7_11_1-00022-redhat-00002</fuse.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>fuse-springboot-bom</artifactId>
        <version>${fuse.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  ...
</project>

在使用依赖关系管理机制指定 BOM 后,可以在不指定工件版本的情况下将 Maven 依赖项添加到 POM 中。例如,要为 camel-hystrix 组件添加一个依赖项,您要将以下 XML 片段添加到 POM 中的 dependencies 元素中:

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-hystrix-starter</artifactId>
</dependency>

请注意,Camel 工件 ID 如何通过 -starter 后缀是:将 Camel Hystrix 组件指定为 camel-hystrix-starter,而非 camel-hystrix。Camel 启动程序组件以针对 Spring Boot 环境进行优化的方式打包。

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部