Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

5.2. Configure Maven to Use the File System Repositories

Overview

The Red Hat JBoss DV Maven repository is available online, so it is not necessary to download and install it locally. However, if you prefer to install the JBoss EAP Maven repository locally, there are three ways to do it: on your local file system, on Apache Web Server, or with a Maven repository manager. This example covers the steps to download the JBoss EAP 6 Maven Repository to the local file system. This option can help you become familiar with using Maven for development but is not recommended for team production environments.

Procedure 5.1. 

  1. Click the Download button to download a .zip file containing the repository.
  2. Unzip the file on the local file system into a directory of your choosing.
  3. Add entries for the unzipped repositories to Maven's settings.xml file. The following code sample contains a profile with the repositories and an activation entry for the profile:
    <?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-6.1.0.GA-redhat-2-repository</id>
              <name>DV 6.1.0 GA Repository</name>
              <url>file://<!-- path to the repository -->/jboss-dv-6.1.0.redhat-3-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-6.1.0.GA-redhat-2-repository</id>
              <name>DV 6.1.0 GA Repository</name>
              <url>file://<!-- path to the repository -->/jboss-dv-6.1.0.redhat-3-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>
Result

The Maven repositories are downloaded, unzipped in a local file system, registered in Maven's settings.xml file, and ready to be used when performing Maven builds.

Troubleshooting

Q: Why do I still see errors when building or deploying my applications?
Q: Why is JBoss Developer Studio using my old Maven configuration?
Q:
Why do I still see errors when building or deploying my applications?
A:
Issue

When you build or deploy a project, it fails with one or both of the following errors:

  • [ERROR] Failed to execute goal on project PROJECT_NAME
  • Could not find artifact ARTIFACT_NAME

Cause

Your cached local Maven repository might contain outdated artifacts.

Resolution

To resolve the issue, delete the cached local repository – the ~/.m2/repository/ directory on Linux or the %SystemDrive%\Users\USERNAME\.m2\repository\ directory on Windows – and run mvn clean install -U. This will force Maven to download correct versions of required artifacts when performing the next build.

Q:
Why is JBoss Developer Studio using my old Maven configuration?
A:
Issue

You have updated your Maven configuration, but this configuration is not reflected in JBoss Developer Studio.

Cause

If JBoss Developer Studio is running when you modify your Maven settings.xml file, this configuration will not be reflected in JBoss Developer Studio.

Resolution

Refresh the Maven settings in the IDE. From the menu, choose WindowPreferences. 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.
Update Maven User Settings

Figure 5.1. Update Maven User Settings