Set Up Maven Repositories Locally

Updated -

Overview

A set of Maven repositories are required to build and deploy applications in Red Hat JBoss Fuse Service Works.

If you provided the location of Maven's settings.xml file during installation, Maven is already configured to use the online JBoss Enterprise Maven Repository and ready for use.

IMPORTANT: The JBoss Enterprise Maven Repository is provided as a technology preview only. This means that it is not fully supported and not recommended for business-critical use. See JBoss Enterprise Maven Reopository for more information.

If you want to configure Maven to use the online JBoss Enterprise Maven Repository, see Set Up Online Maven Repositories.

If you want to configure Maven to use the supported repositories installed locally, follow the procedure below.

Procedure

Step 1. Download the following ZIP archives containing the required repositories:

Step 2. Unzip the downloaded ZIP files into an arbitrary location in a local file system. Then 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 Fuse Service Works -->
        <profile>
          <id>fsw-local-repos</id>
          <repositories>
            <repository>
              <id>fsw-6.0.0.GA-redhat-2-repository</id>
              <name>FSW 6.0.0.GA Repository</name>
              <url>file://<!-- path to the repository -->/fsw-6.0.0.GA-redhat-2-repository</url>
              <layout>default</layout>
              <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
              </releases>
              <snapshots>
                <enabled>false</enabled>
                <updatePolicy>never</updatePolicy>
              </snapshots>
            </repository>
            <repository>
              <id>jboss-eap-6.1.1.GA-maven-repository</id>
              <name>EAP 6.1.1.GA Repository</name>
              <url>file://<!-- path to the repository -->/jboss-eap-6.1.1.GA-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>fsw-6.0.0.GA-redhat-2-repository</id>
              <name>FSW 6.0.0.GA Repository</name>
              <url>file://<!-- path to the repository -->/fsw-6.0.0.GA-redhat-2-repository</url>
              <layout>default</layout>
              <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
              </releases>
              <snapshots>
                <enabled>false</enabled>
                <updatePolicy>never</updatePolicy>
              </snapshots>
            </pluginRepository>
            <pluginRepository>
              <id>jboss-eap-6.1.1.GA-maven-repository</id>
              <name>EAP 6.1.1 GA Repository</name>
              <url>file://<!-- path to the repository -->/jboss-eap-6.1.1.GA-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 Fuse Service Works profile -->
       <activeProfile>fsw-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 does the bpm-service quickstart application fail on build?
Q: Why do I still get errors when building or deploying my applications?
Q: Why is JBoss Developer Studio using my old Maven configuration?

Why does the bpm-service quickstart application fail on build?

Issue

When you build or deploy the bpm-service quickstart application, it fails with the following error:

[ERROR] Failed to execute goal on project switchyard-quickstart-bpm-service: Could not resolve dependencies for project org.switchyard.quickstarts:switchyard-quickstart-bpm-service:jar:1.1.1-p5-redhat-1: The following artifacts could not be resolved: org.jboss.netty:netty:jar:3.2.6.Final-redhat-2, org.apache.lucene:lucene-queryparser:jar:3.6.2-redhat-4: Could not find artifact org.jboss.netty:netty:jar:3.2.6.Final-redhat-2 in fsw-6.0.0.GA-redhat-2-repository (file:///home/belong/maven_repos/fsw-6.0.0.GA-redhat-2-repository) -> [Help 1]

Cause

The bpm-service quickstart application requires additional dependencies, provided by the JBoss EAP 6.0.1 Maven repository and the JBoss Fuse Service Works Rollup Patch 2 Incremental Maven Repository.

Resolution

Download the required Maven repositories and update the Maven settings.xml file, as described in the note in Step 1 of the procedure above.

Why do I still get errors when building or deploying my applications?

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.

Why is JBoss Developer Studio using my old Maven configuration?

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 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.

maven_offline.png

Comments