第3章 オンラインリポジトリーの Maven の settings.xml ファイルの設定
ユーザーの settings.xml
ファイルを設定して、Maven プロジェクトでオンライン Maven リポジトリーを使用できます。これは、推奨の手法です。リポジトリーマネージャーまたは共有サーバー上のリポジトリーと使用する Maven 設定は、プロジェクトの制御および管理性を向上させます。
Maven の settings.xml
ファイルを変更してリポジトリーを設定する場合、変更はすべての Maven プロジェクトに適用されます。
手順
テキストエディターまたは統合開発環境 (IDE) で Maven の
~/.m2/settings.xml
ファイルを開きます。注記~/.m2/
ディレクトリーにsettings.xml
ファイルがない場合には、$MAVEN_HOME/.m2/conf/
ディレクトリーから~/.m2/
ディレクトリーにsettings.xml
ファイルをコピーします。以下の行を Maven の
settings.xml
ファイルの<profiles>
要素に追加します。<!-- Configure the Maven repository --> <profile> <id>red-hat-enterprise-maven-repository</id> <repositories> <repository> <id>red-hat-enterprise-maven-repository</id> <url>https://maven.repository.redhat.com/ga/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>red-hat-enterprise-maven-repository</id> <url>https://maven.repository.redhat.com/ga/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile>
以下の行を
settings.xml
ファイルの<activeProfiles>
要素に追加し、ファイルを保存します。<activeProfile>red-hat-enterprise-maven-repository</activeProfile>
3.1. Maven archetype からの Spring Boot ビジネスアプリケーションの作成
Maven アーキタイプを使用して、Spring Boot フレームワークを使用するビジネスアプリケーションを作成できます。これにより、Red Hat Process Automation Manager のインストールと設定の必要性がなくなります。ビジネスアセットプロジェクト、データモデルプロジェクト、またはサービスプロジェクトを作成できます。
前提条件
- Apache Maven 3.5 以降
手順
次のコマンドのいずれかを入力して、Spring Boot ビジネスアプリケーションプロジェクトを作成します。これらのコマンドで、business-application
をビジネスアプリケーションの名前に置き換えます。
ビジネスプロセス、ルールおよびフォームを含むビジネスアセットプロジェクトを作成するには:
mvn archetype:generate -B -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-kjar-archetype -DarchetypeVersion=7.67.0.Final-redhat-00024 -DgroupId=com.company -DartifactId=business-application-kjar -Dversion=1.0-SNAPSHOT -Dpackage=com.company
このコマンドは、
business-application-kjar-1.0-SNAPSHOT.jar
を生成するプロジェクトを作成します。サービスプロジェクトとビジネス資産プロジェクトの間で共有される共通のデータ構造を提供するデータモデル資産プロジェクトを作成するには、次の手順に従います。
mvn archetype:generate -B -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-model-archetype -DarchetypeVersion=7.67.0.Final-redhat-00024 -DgroupId=com.company -DartifactId=business-application-model -Dversion=1.0-SNAPSHOT -Dpackage=com.company.model
このコマンドは、
business-application-model-1.0-SNAPSHOT.jar
を生成するプロジェクトを作成します。ケース管理機能を提供する動的資産プロジェクトを作成するには:
mvn archetype:generate -B -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-kjar-archetype -DarchetypeVersion=7.67.0.Final-redhat-00024 -DcaseProject=true -DgroupId=com.company -DartifactId=business-application-kjar -Dversion=1.0-SNAPSHOT -Dpackage=com.company
このコマンドは、
business-application-kjar-1.0-SNAPSHOT.jar
を生成するプロジェクトを作成します。サービスプロジェクト (ビジネスを運用するビジネスロジックを含むさまざまな機能を備えたサービスを提供するデプロイ可能なプロジェクト) を作成するには、次のいずれかのコマンドを入力します。
ビジネス自動化は、プロセス管理、ケース管理、意思決定管理、および最適化の機能をカバーしています。これらはデフォルトで、ビジネスアプリケーションのサービスプロジェクトで設定されますが、設定によってオフにすることができます。プロセス管理、ケース管理、意思決定管理、および最適化の機能を含むビジネスアプリケーションサービスプロジェクト (デフォルトの設定) を作成するには:
mvn archetype:generate -B -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-service-spring-boot-archetype -DarchetypeVersion=7.67.0.Final-redhat-00024 -DgroupId=com.company -DartifactId=business-application-service -Dversion=1.0-SNAPSHOT -Dpackage=com.company.service -DappType=bpm
意思決定管理は、主に意思決定とルールに関連する機能をカバーしています。意思決定およびルール関連の機能を含む意思決定管理サービスプロジェクトを作成するには:
mvn archetype:generate -B -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-service-spring-boot-archetype -DarchetypeVersion=7.67.0.Final-redhat-00024 -DgroupId=com.company -DartifactId=business-application-service -Dversion=1.0-SNAPSHOT -Dpackage=com.company.service -DappType=brm
ビジネスの最適化では、計画の問題とソリューションに関連する機能がカバーされています。OptaPlanner サービスプロジェクトの Red Hat ビルドを作成して、計画の問題とソリューション関連の機能を解決するには、次の手順を実行します。
mvn archetype:generate -B -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-service-spring-boot-archetype -DarchetypeVersion=7.67.0.Final-redhat-00024 -DgroupId=com.company -DartifactId=business-application-service -Dversion=1.0-SNAPSHOT -Dpackage=com.company.service -DappType=planner
これらのコマンドは、
business-application-service-1.0-SNAPSHOT.jar
を生成するプロジェクトを作成します。多くの場合に、サービスプロジェクトにはビジネスアセットとデータモデルプロジェクトが含まれます。ビジネスアプリケーションは、サービスをより小さなコンポーネントサービスプロジェクトに分割して、管理性を向上できます。