第8章 プロジェクトでの Maven 依存関係の設定
外部の Maven リポジトリーを使用してプロジェクトをデプロイします。プロジェクトを作成すると、Business Central は、Business Central に設定する Maven リポジトリーを使用します。Maven グローバルまたはユーザー設定を使用して、以下のファイルを修正することで、Red Hat Process Automation Manager の公開リポジトリーから依存関係を取得するように、すべての Red Hat Process Automation Manager プロジェクトを指定します。
-
Maven
settings.xmlファイル。 -
Maven プロジェクトオブジェクトモデル (POM) ファイル (
pom.xml)。
詳細は『Packaging and deploying a project』を参照してください。
8.1. Maven 設定ファイルの修正
ビルドインリポジトリーの代わりに、外部 Maven リポジトリーを使用するように Business Central および Process Server を設定できます。この場合、ビルドしたプロジェクトの全 KJAR ファイルはこのリポジトリーにプッシュされます。このファイルは、統合プロセスを実装する場合に必要に応じてリポジトリーから処理できます。
前提条件/事前作業
Business Central および Process Server がインストールされている。インストールオプションは『Planning a Red Hat Process Automation Manager installation』を参照してください。
手順
-
外部リポジトリーの接続およびアクセスの詳細が含まれる Maven
settings.xmlファイルを作成します。settings.xmlファイルの詳細は Maven の 『Settings Reference』を参照してください。 -
既知の場所 (例:
/opt/custom-config/settings.xml) にファイルを保存します。 -
Red Hat Process Automation Manager インストールディレクトリーで、
standalone-full.xmlファイルに移動します。たとえば、Red Hat Process Automation Manager に Red Hat JBoss EAP インストールを使用する場合は$EAP_HOME/standalone/configuration/standalone-full.xmlに移動します。 standalone-full.xmlの<system-properties>タグで、kie.maven.settings.customプロパティーにsettings.xmlファイルのフルパス名を設定します。以下に例を示します。
<property name="kie.maven.settings.custom" value="/opt/custom-config/settings.xml"/>
- Business Central および Process Server を起動します。
8.2. Maven POM ファイルの修正
お使いの Red Hat Process Automation Manager プロジェクトで適切な Maven 依存関係を使用するには、プロジェクトの pom.xml ファイルに該当する BOM (bill of materials) ファイルを追加する必要があります。BOM ファイルを追加すると、提供される Maven リポジトリーから、推移的依存関係の適切なバージョンがプロジェクトに追加されます。
詳細は「What is the mapping between RHPAM product and maven library version?」を参照してください。
手順
pom.xmlファイルで BOM を宣言します。以下に例を示します。<dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.bom</groupId> <artifactId>rhpam-platform-bom</artifactId> <version>7.0.0.GA-redhat-3</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- Your dependencies --> </dependencies>
-
<dependencies>タグでお使いのプロジェクトに必要な依存関係を宣言します。製品の BOM をプロジェクトにインポートしたら、ユーザー向け製品依存関係のバージョンが定義されるため、<dependency>要素のサブ要素<version>を指定する必要はありません。ただし、<dependency>要素を使用して、プロジェクトで使用する依存関係を宣言する必要があります。 Business Central に作成されない標準のプロジェクトでは、お使いのプロジェクトに必要な依存関係をすべて指定します。Business Central に作成するプロジェクトでは、標準の Drools および jBPM のエンジンの依存関係が Business Central に自動的に提供されます。
標準的な Red Hat Process Automation Manager プロジェクトでは、使用する機能に応じて、以下の依存関係を宣言します。
埋め込まれた jBPM エンジン依存関係
<!-- Public KIE API --> <dependency> <groupId>org.kie</groupId> <artifactId>kie-api</artifactId> </dependency> <!-- jBPM engine core dependencies --> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-flow</artifactId> </dependency> <dependency> <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 対応 jBPM エンジン依存関係
<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 プロジェクトでは、以下の依存関係を宣言します。
埋め込まれた Drools エンジン依存関係
<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:drools-workbench-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>
Process Server を使用するには、以下の依存関係を宣言します。
クライアントアプリケーションの Process Server 依存関係
<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}は、「What is the mapping between RHPAM product and maven library version?」に記載されている 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>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.