3.2. Red Hat Process Automation Manager Maven リポジトリーのダウンロードおよび設定

オンライン Maven リポジトリーを使用しない場合は、Red Hat Process Automation Manager Maven リポジトリーをダウンロードして設定できます。Red Hat Process Automation Manager Maven リポジトリーには、Java 開発者がアプリケーションの構築に使用する要件の多くが含まれています。この手順では、Maven の settings.xml ファイルを編集し、Red Hat Process Automation Manager Maven リポジトリーを設定する方法を説明します。

注記

Maven の settings.xml ファイルを変更してリポジトリーを設定する場合、変更はすべての Maven プロジェクトに適用されます。

前提条件

  • Red Hat Process Automation Manager Spring Boot プロジェクトを作成している。

手順

  1. Red Hat カスタマーポータルの Software Downloads ページに移動し (ログインが必要) 、ドロップダウンオプションから製品およびバージョンを選択します。

    • Product: Process Automation Manager
    • バージョン: 7.11
  2. Red Hat Process Automation Manager 7.11 Maven Repository (rhpam-7.11.0-maven-repository.zip) をダウンロードします。
  3. ダウンロードしたアーカイブを展開します。
  4. ~/.m2/ ディレクトリーに移動し、テキストエディターまたは統合開発環境 (IDE) で Maven の settings.xml ファイルを開きます。
  5. 以下の行を Maven settings.xml ファイルの <profiles> 要素に追加します。ここで、<MAVEN_REPOSITORY> はダウンロードした Maven リポジトリーのパスです。<MAVEN_REPOSITORY> の形式は file://$PATH の形式 (例: file:///home/userX/rhpam-7.11.0.GA-maven-repository/maven-repository) にする必要があります。

    <profile>
      <id>red-hat-enterprise-maven-repository</id>
      <repositories>
        <repository>
          <id>red-hat-enterprise-maven-repository</id>
          <url>MAVEN_REPOSITORY</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>red-hat-enterprise-maven-repository</id>
          <url><MAVEN_REPOSITORY></url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  6. 以下の行を Maven の settings.xml ファイルの <activeProfiles> 要素に追加し、ファイルを保存します。

    <activeProfile>red-hat-enterprise-maven-repository</activeProfile>
重要

Maven リポジトリーに古いアーティファクトが含まれる場合は、プロジェクトをビルドまたはデプロイしたときに以下のいずれかの Maven エラーメッセージが表示されることがあります。ここで、<ARTIFACT_NAME> は不明なアーティファクトの名前で、<PROJECT_NAME> は構築を試みているプロジェクトの名前になります。

  • Missing artifact <PROJECT_NAME>
  • [ERROR] Failed to execute goal on project <ARTIFACT_NAME>; Could not resolve dependencies for <PROJECT_NAME>

この問題を解決するには、~/.m2/repository ディレクトリーにあるローカルリポジトリーのキャッシュバージョンを削除し、最新の Maven アーティファクトを強制的にダウンロードします。