搜索

15.4. 使用 BOM 对应用程序的依赖项进行补丁

download PDF

如果您的应用程序 pom.xml 文件被配置为使用新样式的 BOM,请按照本节中的说明升级 Maven 依赖项。

15.4.1. 更新 Spring Boot 应用程序中的依赖项

以下代码片段显示了 OpenShift 上 Fuse 中 Spring Boot 应用程序的 POM 文件标准布局,突出显示一些重要属性设置:

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

    <fuse.version>7.13.0.fuse-7_13_0-00012-redhat-00001</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>
  ...
  <build>
    ...
    <plugins>
      <!-- Core plugins -->
      ...
      <plugin>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        ...
        <version>${fuse.version}</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>openshift</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jboss.redhat-fuse</groupId>
            <artifactId>openshift-maven-plugin</artifactId>
            ...
            <version>${fuse.version}</version>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

当涉及修补或升级应用程序时,以下版本设置非常重要:

fuse.version
定义 new-style fuse-springboot-bom BOM 的版本,以及 openshift-maven-plugin 插件的版本和 spring-boot-maven-plugin 插件。

15.4.2. 更新 Karaf 应用中的依赖项

以下代码片段显示了 OpenShift 上 Fuse 中 Karaf 应用程序的 POM 文件标准布局,突出显示一些重要属性设置:

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

    <fuse.version>7.13.0.fuse-7_13_0-00012-redhat-00001</fuse.version>
    ...
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>fuse-karaf-bom</artifactId>
        <version>${fuse.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  ...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>karaf-maven-plugin</artifactId>
        <version>${fuse.version}</version>
        ...
      </plugin>
      ...
      <plugin>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>openshift-maven-plugin</artifactId>
        <version>${fuse.version}</version>
        ...
      </plugin>
    </plugins>
  </build>

</project>

当涉及修补或升级应用程序时,以下版本设置非常重要:

fuse.version
定义 new-style fuse-karaf-bom BOM 的版本,以及 openshift-maven-plugin 插件的版本和 karaf-maven-plugin 插件。

15.4.3. 更新 JBoss EAP 应用中的依赖项

以下代码片段显示了 OpenShift 上 Fuse 中 JBoss EAP 应用程序的 POM 文件标准布局,突出显示一些重要属性设置:

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

    <fuse.version>7.13.0.fuse-7_13_0-00012-redhat-00001</fuse.version>
    ...
  </properties>

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

当涉及修补或升级应用程序时,以下版本设置非常重要:

fuse.version
定义 fuse-eap-bom BOM 文件的版本(替换 old-style wildfly-camel-bom BOM 文件)。通过将 BOM 版本更新至特定的补丁版本,您也会有效地更新 JBoss EAP Maven 依赖项上的所有 Fuse。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.