-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat Fuse
Chapter 6. Maven Repositories
6.1. About Maven
http://
when located on an HTTP server, or file://
when located on a file server. The default repository is the public remote Maven 2 Central Repository.
settings.xml
file. You can either configure global Maven settings in the M2_HOME/conf/settings.xml
file, or user-level settings in the USER_HOME/.m2/settings.xml
file.
Note
6.2. About The Provided Maven Repositories
settings.xml
file during installation, Maven is already configured to use the online repositories. If you did not provide the location during installation, you need to configure Maven manually by following the procedure in Section 6.4, “Configuring Maven to Use the Online Repositories” or Section 6.3, “Configuring Maven to Use the File System Repositories”.
Important
6.3. Configuring Maven to Use the File System Repositories
In situations where you cannot use the online repositories, you will have to download and configure the required repositories locally.
Procedure 6.1.
- Download the following ZIP archives containing the required repositories:
Note
Alternatively, the ZIP archives can be downloaded from http://access.redhat.com/jbossnetwork/. - Unzip the downloaded ZIP files into an arbitrary location in a local file system.
- 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>
Important
bpm-service
quickstart application will not build without two additional repositories. If you want to build this application, download the following repositories and add them to your setting.xml
file in the same way as that shown above.
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.
- 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?
bpm-service
quickstart application fail on build?
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]
The bpm-service
quickstart application requires an additional two dependencies, provided by the JBoss EAP 6.0.1 and JBoss Web Framework Kit 2.5.0 Maven repositories.
- Download the following ZIP archives, and unzip them into a location of your choice:
- Add entries for the unzipped repositories to your Maven
settings.xml
file:<?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> <repository> <id>jboss-wfk-2.5.0-maven-repository</id> <name>JBoss WFK 2.5.0 Repository</name> <url>file://<!-- path to the repository -->/jboss-wfk-2.5.0-maven-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.0.1-maven-repository</id> <name>EAP 6.0.1 Repository</name> <url>file://<!-- path to the repository -->/jboss-eap-6.0.1-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> <pluginRepository> <id>jboss-wfk-2.5.0-maven-repository</id> <name>JBoss WFK 2.5.0 Repository</name> <url>file://<!-- path to the repository -->/jboss-wfk-2.5.0-maven-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.0.1-maven-repository</id> <name>EAP 6.0.1 Repository</name> <url>file://<!-- path to the repository -->/jboss-eap-6.0.1-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>
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
Your cached local Maven repository might contain outdated artifacts.
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.
You have updated your Maven configuration, but this configuration is not reflected in JBoss Developer Studio.
If JBoss Developer Studio is running when you modify your Maven settings.xml
file, this configuration will not be reflected in JBoss Developer Studio.
Figure 6.1. Update Maven User Settings
6.4. Configuring Maven to Use the Online Repositories
settings.xml
file during installation, Maven is already configured to use the online repositories. If you did not provide the location during installation, you need to configure Maven manually by following the procedure in Section 6.4, “Configuring Maven to Use the Online Repositories” or Section 6.3, “Configuring Maven to Use the File System Repositories”.
Procedure 6.2. Configuring Maven to Use the Online Repositories
- Add entries for the online repositories to Maven's
settings.xml
file as in the code sample below:<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/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <profiles> <!-- Profile with online repositories required by Fuse Service Works --> <profile> <id>fsw-online-repos</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> <repository> <id>jboss-public-repository</id> <url>http://repository.jboss.org/nexus/content/repositories/public/</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> <pluginRepository> <id>jboss-public-plugin-repository</id> <url>http://repository.jboss.org/nexus/content/repositories/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <!-- Activation of the Fuse Service Works profile --> <activeProfile>fsw-online-repos</activeProfile> </activeProfiles> </settings>
- If you modified the
settings.xml
file while JBoss Developer Studio was running, you must refresh 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.Figure 6.2. Update Maven User Settings
Maven has been configured to use the online repositories provided for Red Hat JBoss Fuse Service Works.
Important
- Missing artifact ARTIFACT_NAME
- [ERROR] Failed to execute goal on project PROJECT_NAME; Could not resolve dependencies for PROJECT_NAME
~/.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.
6.5. Dependency Management
pom.xml
file. Adding the BOM and parent will ensure that correct versions of plugins and transitive dependencies from the provided Maven repositories are included in the project.
pom.xml
file:
org.jboss.ip.component.management:ip-parent:1.1-redhat-5
dependencyManagement
section:
org.jboss.ip.component.management:ip-dependency-management-all:1.1-redhat-5
org.jboss.component.management:jboss-dependency-management-all:6.1.1.Final-redhat-61
<parent> <groupId>org.jboss.ip.component.management</groupId> <artifactId>ip-parent</artifactId> <version>1.1-redhat-5</version> </parent> ... <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.ip.component.management</groupId> <artifactId>ip-dependency-management-all</artifactId> <type>pom</type> <version>1.1-redhat-5</version> <scope>import</scope> </dependency> <dependency> <groupId>org.jboss.component.management</groupId> <artifactId>jboss-dependency-management-all</artifactId> <type>pom</type> <version>6.1.1.Final-redhat-61</version> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>