2.3.2. Configure the JBoss Enterprise Application Platform Maven Repository Using the Maven Settings
There are two approaches to direct Maven to use the JBoss Enterprise Application Platform Maven Repository in your project:
This task shows you how to direct Maven to use the JBoss Enterprise Application Platform Maven Repository across all projects using the Maven global or user settings. This is the recommended approach.
- You can modify the Maven settings.
- You can configure the project's POM file.
Note
The URL of the repository will depend on where the repository is located; on the filesystem, or web server. For information on how to install the repository, refer to the Maven chapter of the Development Guide for JBoss Enterprise Application Platform 6. The following are examples for each of the installation options:
- File System
file:///path/to/repo/jboss-eap-6.0.0-maven-repository
- Apache Web Server
http://intranet.acme.com/jboss-eap-6.0.0-maven-repository/
- Nexus Repository Manager
https://intranet.acme.com/nexus/content/repositories/jboss-eap-6.0.0-maven-repository
You can configure Maven to use the JBoss Enterprise Application Platform Repository using either the Maven install or the user install settings. For more information about the location of the settings and how they behave, refer to the Maven chapter of the Development Guide for JBoss Enterprise Application Platform 6. .
To use the JBoss Enterprise Application Platform repository on a local user system, follow these instructions:
Procedure 2.6. Configure the Settings
- Open the
settings.xml
for the type of configuration you have chosen.Global Settings
If you are configuring theglobal
settings, open theM2_HOME/conf/settings.xml
file.User Settings
If you are configuring user specific settings and you do not yet have aUSER_HOME/.m2/settings.xml
file, copy thesettings.xml
file from theM2_HOME/conf/
directory into theUSER_HOME/.m2/
directory.
- Copy the following XML into the
<profiles>
element of thesettings.xml
file. Be sure to change the<url>
to the actual repository location.<profile> <id>jboss-eap-repository</id> <repositories> <repository> <id>jboss-eap-repository</id> <name>JBoss EAP Maven Repository</name> <url>file:///path/to/repo/jboss-eap-6.0.0-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>jboss-eap-repository-group</id> <name>JBoss EAP Maven Repository</name> <url> file:///path/to/repo/jboss-eap-6.0.0-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>
Copy the following XML into the<activeProfiles>
element of thesettings.xml
file.<activeProfile>jboss-eap-repository</activeProfile>
- If you modify the
settings.xml
file while JBoss Developer Studio is running, you must refresh the user settings. From the menu, choose Window → Preferences. In the Preferences Window, expand Maven and choose User Settings. Click the Update Settings button to refresh the Maven user settings in JBoss Developer Studio.Figure 2.1. Update Maven User Settings
Important
If your Maven repository contains outdated artifacts, you may encounter one of the following Maven error messages when you build or deploy your project:
To resolve the issue, delete the cached version of your local repository to force a download of the latest Maven artifacts. The cached repository is located in your
- Missing artifact ARTIFACT_NAME
- [ERROR] Failed to execute goal on project PROJECT_NAME; Could not resolve dependencies for PROJECT_NAME
~/.m2/repository/
subdirectory on Linux, or the %SystemDrive%\Users\USERNAME\.m2\repository\
subdirectory on Windows.
Result
The JBoss Enterprise Application Platform repository has now been configured.