Red Hat Training
A Red Hat training course is available for Red Hat JBoss Data Virtualization
4.2. ファイルシステムリポジトリーを使用するよう Maven を設定
Red Hat JBoss EAP DV の Maven リポジトリーはオンライン上にあるため、ローカルにダウンロードし、インストールする必要はありません。しかし、JBoss EAP の Maven リポジトリーをローカルでインストールする場合は、ローカルファイルシステム上のインストール、Apache Web Server 上のインストール、および Maven リポジトリーマネージャーを用いたインストールの 3 つの方法を使用できます。この例では、ローカルのファイルシステムへ JBoss EAP 6 の Maven リポジトリーをダウンロードする手順を取り上げます。この方法は、開発環境で Maven の知識を深めることができますが、チームによる本番環境での使用は推奨されません。
手順4.1
- ダウンロード ボタンをクリックし、リポジトリーが含まれる
.zipファイルをダウンロードします。 - ローカルファイルシステム上の Zip 形式のファイルを希望のディレクトリーで展開します。
- 展開されていないリポジトリーのエントリーを Maven の
settings.xmlファイルに追加します。以下のコード例には、リポジトリーがあるプロファイルと、プロファイルのアクティベートエントリーが含まれます。<?xml version="1.0" encoding="UTF-8" standalone="no"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <profiles> <!-- Profile with local repositories required by Data Virtualization --> <profile> <id>dv-local-repos</id> <repositories> <repository> <id>dv-[VERSION]-repository</id> <name>DV [VERSION] GA Repository</name> <url>file://<!-- path to the repository -->/jboss-dv-[VERSION].redhat-[VERSION]-maven-repository/maven-repository</url> <layout>default</layout> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>false</enabled> <updatePolicy>never</updatePolicy> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>dv-[VERSION].GA-redhat-[VERSION]-repository</id> <name>DV [VERSION] GA Repository</name> <url>file://<!-- path to the repository -->/jboss-dv-[VERSION].redhat-[VERSION]-maven-repository/maven-repository</url> <layout>default</layout> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>false</enabled> <updatePolicy>never</updatePolicy> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <!-- Activation of the Data Virtualization profile --> <activeProfile>dv-local-repos</activeProfile> </activeProfiles> </settings>
Maven リポジトリーがダウンロードされ、ローカルファイルシステムで展開された後、Maven の settings.xml ファイルに登録されます。Maven の構築を実行するときに使用できます。
プロジェクトをビルドまたはデプロイするときに、以下のエラーの 1 つまたは両方が発生し、失敗します。
[ERROR] Failed to execute goal on project PROJECT_NAMECould not find artifact ARTIFACT_NAME
キャッシュされたローカル Maven リポジトリーに古いアーティファクトが含まれている可能性があります。
この問題を解決するには、キャッシュされたローカルディレクトリーを削除します。このディレクトリーは Linux の場合は ~/.m2/repository/ ディレクトリー、Windows の場合は %SystemDrive%\Users\USERNAME\.m2\repository\ ディレクトリーになります。mvn clean install -U を実行します。これにより、次回構築を行うと Maven が必要なアーティファクトの適切なバージョンをダウンロードするようになります。
Maven 設定を更新しても、この設定は JBoss Developer Studio には反映されません。
Maven の settings.xml ファイルの編集時に JBoss Developer Studio が実行されていると、この設定は JBoss Developer Studio には反映されません。

図4.1 Maven ユーザー設定の更新