Set Up Online Maven Repositories

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 Repository for more details.

If you want to configure Maven to use the supported repositories installed locally, see Set Up Maven Repositories Locally.

If you want to configure Maven to use the online JBoss Enterprise Maven Repository, follow the procedure below.

Procedure

Add entries for the online repository to Maven's settings.xml file as in the code sample below:

<?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>
            <id>redhat-techpreview-all-repository</id>
            <repositories>
                <repository>
                    <id>redhat-techpreview-all-repository</id>
                    <name>Red Hat Tech Preview repository (all)</name>
                    <url>http://maven.repository.redhat.com/techpreview/all/</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>redhat-techpreview-all-repository</id>
                    <name>Red Hat Tech Preview repository (all)</name>
                    <url>http://maven.repository.redhat.com/techpreview/all/</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>
        <activeProfile>redhat-techpreview-all-repository</activeProfile>
    </activeProfiles>
</settings>

Result

Maven has been configured to use the online repositories provided for Red Hat JBoss Fuse Service Works.

Troubleshooting

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 do I still get errors when building or deploying my applications?

Issue

You encounter one of the following Maven errors when you build or deploy your project:

  • [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. This will force Maven to download correct versions of required artifacts during the next build.

Why is JBoss Developer Studio using my old Maven configuration?

Issue

The Maven configuration has been updated, but the new configuration has not been reflected in JBoss Developer Studio.

Cause

If JBoss Develper Studio is funning 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
Update Maven User Settings

Comments