4.2.4.2. コマンドラインでの使用向け Maven 設定
- クイックスタートに同梱された事前定義済み
settings.xml
ファイルをコピーします。 - Maven
settings.xml
ファイルを手動で編集します。
設定を開始する前に、Maven をインストールする必要があります。詳細については、 「Maven のダウンロードとインストール」を参照してください。
手順4.4 クイックスタートサンプルの設定を使用した Maven の設定
settings.xml
ファイルが同梱されています。クイックスタートをダウンロードした場合は、この設定方法が最も簡単です。
- この手順では、既存の Maven 設定ファイルが上書きされるため、既存の Maven
settings.xml
ファイルをバックアップする必要があります。- Maven インストールディレクトリーの場所を確認します。通常、
USER_HOME/.m2/
ディレクトリーにインストールされています。- オペレーティングシステムが Linux または Mac の場合は、
~/.m2/
になります。 - Windows の場合は、
\Documents and Settings\USER_NAME\.m2\
または\Users\USER_NAME\.m2\
になります。
- 既存の
USER_HOME/.m2/settings.xml
ファイルがある場合、名前を変更してバックアップコピーを作成し、後で復元できるようにします。
- クイックスタートをまだダウンロードしていない場合は、 「クイックスタートのダウンロード」に記載された手順に従ってください。
QUICKSTART_HOME/settings.xml
ファイルをUSER_HOME/.m2/
ディレクトリーへコピーします。- Red Hat JBoss Developer Studio の実行中に
settings.xml
ファイルを変更する場合は、『Refresh the Red Hat JBoss Developer Studio User Settings』というトピックの最後に記載された手順に従ってください。
手順4.5 オンラインの JBoss EAP Maven リポジトリーを使用するよう手作業で Maven 設定を編集および設定する
- Maven インストールディレクトリーの場所を確認します。通常、
USER_HOME/.m2/
ディレクトリーにインストールされています。- オペレーティングシステムが Linux または Mac の場合は、
~/.m2/
になります。 - Windows の場合は、
\Documents and Settings\USER_NAME\.m2\
または\Users\USER_NAME\.m2\
になります。
settings.xml
ファイルが見つからない場合は、USER_HOME/.m2/conf/
ディレクトリーのsettings.xml
ファイルをUSER_HOME/.m2/
ディレクトリーへコピーします。- 次の XML をファイルの
<profiles>
要素へコピーします。<!-- Configure the JBoss GA Maven repository --> <profile> <id>jboss-ga-repository</id> <repositories> <repository> <id>jboss-ga-repository</id> <url>http://maven.repository.redhat.com/techpreview/all</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>jboss-ga-plugin-repository</id> <url>http://maven.repository.redhat.com/techpreview/all</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> <!-- Configure the JBoss Early Access Maven repository --> <profile> <id>jboss-earlyaccess-repository</id> <repositories> <repository> <id>jboss-earlyaccess-repository</id> <url>http://maven.repository.redhat.com/earlyaccess/all/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>jboss-earlyaccess-plugin-repository</id> <url>http://maven.repository.redhat.com/earlyaccess/all/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile>
次の XML をsettings.xml
ファイルの<activeProfiles>
要素へコピーします。<activeProfile>jboss-ga-repository</activeProfile> <activeProfile>jboss-earlyaccess-repository</activeProfile>
- Red Hat JBoss Developer Studio の実行中に
settings.xml
ファイルを変更する場合は、『Refresh the Red Hat JBoss Developer Studio User Settings』というトピックの最後に記載された手順に従ってください。
手順4.6 Red Hat JBoss Developer Studio ユーザー設定の更新
settings.xml
ファイルを変更する場合は、ユーザー設定を更新する必要があります。
- メニューより、→ を選択します。
- Preferences ウインドウで Maven を展開し、User Settings を選択します。
図4.11 Maven ユーザー設定の更新
重要
- Missing artifact ARTIFACT_NAME
- [ERROR] Failed to execute goal on project PROJECT_NAME; Could not resolve dependencies for PROJECT_NAME
~/.m2/repository/
サブディレクトリー (Linux の場合) または %SystemDrive%\Users\USERNAME\.m2\repository\
サブディレクトリー (Windows の場合) に存在します。