搜索

第 21 章 Red Hat Process Automation Manager 的 Maven 设置和软件仓库

download PDF

创建 Red Hat Process Automation Manager 项目时,B Business Central 使用为 Business Central 配置的 Maven 存储库。您可以通过修改 Maven 项目对象模型(POM)文件(POM)文件(pom.xml)文件,使用 Maven 全局或用户设置来指示所有 Red Hat Process Automation Manager 项目,从公共 Red Hat Process Automation Manager 存储库检索依赖项。您还可以将 Business Central 和 KIE 服务器配置为使用外部 Maven 存储库,或准备 Maven mirror 以供离线使用。

有关 Red Hat Process Automation Manager 打包和部署选项的更多信息,请参阅 打包和部署 Red Hat Process Automation Manager 项目

21.1. 为 Red Hat Process Automation Manager 添加 Maven 依赖项

要在 Red Hat Process Automation Manager 项目中使用正确的 Maven 依赖项,请将 Red Hat Business Automation 材料(BOM)文件添加到项目的 pom.xml 文件中。Red Hat Business Automation BOM 适用于 Red Hat Decision Manager 和 Red Hat Process Automation Manager。添加 BOM 文件时,项目中包含来自提供的 Maven 存储库的正确依赖项版本。

有关 Red Hat Automation BOM 的更多信息,请参阅 Red Hat Process Automation Manager 和 Maven 库版本之间的映射是什么?

流程

  1. pom.xml 文件中声明 Red Hat Business Automation BOM:

    <dependencyManagement>
     <dependencies>
      <dependency>
       <groupId>com.redhat.ba</groupId>
       <artifactId>ba-platform-bom</artifactId>
       <version>7.13.5.redhat-00002</version>
       <type>pom</type>
       <scope>import</scope>
      </dependency>
     </dependencies>
    </dependencyManagement>
    <dependencies>
    <!-- Your dependencies -->
    </dependencies>
  2. 在 <dependencies> 标签中声明项目 所需的依赖项。将产品 BOM 导入到项目中后,定义了面向用户的依赖项的版本,因此您无需指定这些 < dependency > 元素的 <version > 子元素。但是,您必须使用 & lt;dependency > 元素来声明您要在项目中使用的依赖项。
  3. 对于未在 Business Central 中编写的独立项目,请指定项目所需的所有依赖项。在您在 Business Central 中编写的项目中,Be Business Central 会自动提供基本决策引擎和流程引擎依赖项。

    • 对于基本的 Red Hat Process Automation Manager 项目,根据您要使用的功能,声明以下依赖项:

      嵌入式进程引擎依赖项

      <!-- Public KIE API -->
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-api</artifactId>
      </dependency>
      
      <!-- Core dependencies for process engine -->
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-flow</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-flow-builder</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-bpmn2</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-runtime-manager</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-persistence-jpa</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-query-jpa</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-audit</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-kie-services</artifactId>
      </dependency>
      
      <!-- Dependency needed for default WorkItemHandler implementations. -->
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-workitems-core</artifactId>
      </dependency>
      
      <!-- Logging dependency. You can use any logging framework compatible with slf4j. -->
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
      </dependency>

    • 对于使用 CDI 的 Red Hat Process Automation Manager 项目,您通常会声明以下依赖项:

      启用 CDI 的进程引擎依赖项

      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-api</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-kie-services</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-services-cdi</artifactId>
      </dependency>

    • 对于基本的 Red Hat Process Automation Manager 项目,声明以下依赖项:

      嵌入式决策引擎依赖项

      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-compiler</artifactId>
      </dependency>
      
      <!-- Dependency for persistence support. -->
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-persistence-jpa</artifactId>
      </dependency>
      
      <!-- Dependencies for decision tables, templates, and scorecards.
      For other assets, declare org.drools:business-central-models-* dependencies. -->
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-decisiontables</artifactId>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-templates</artifactId>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-scorecards</artifactId>
      </dependency>
      
      <!-- Dependency for loading KJARs from a Maven repository using KieScanner. -->
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-ci</artifactId>
      </dependency>

    • 要使用 KIE 服务器,声明以下依赖项:

      客户端应用程序 KIE 服务器依赖项

      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-client</artifactId>
      </dependency>

    • 要为 Red Hat Process Automation Manager 创建远程客户端,请声明以下依赖项:

      客户端依赖项

      <dependency>
        <groupId>org.uberfire</groupId>
        <artifactId>uberfire-rest-client</artifactId>
      </dependency>

    • 在创建包含资产的 JAR 文件(如规则和进程定义)时,请将 Maven 项目的打包类型指定为 kjar,并使用 org.kie:kie-maven-plugin 来处理位于 < project > 元素下的 kjar 打包类型。在以下示例中,${kie.version} 是列出的 Maven 库版本,在 Red Hat Process Automation Manager 和 Maven 库版本之间有什么映射?

      <packaging>kjar</packaging>
      <build>
       <plugins>
        <plugin>
         <groupId>org.kie</groupId>
         <artifactId>kie-maven-plugin</artifactId>
         <version>${kie.version}</version>
         <extensions>true</extensions>
        </plugin>
       </plugins>
      </build>
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.