Appendix B. Using Red Hat Maven repositories
This section describes how to use Red Hat-provided Maven repositories in your software.
B.1. Using the online repository
Red Hat maintains a central Maven repository for use with your Maven-based projects. For more information, see the repository welcome page.
There are two ways to configure Maven to use the Red Hat repository.
Adding the repository to your Maven settings
This method of configuration applies to all Maven projects owned by your user, as long as your POM file does not override the repository configuration and the included profile is enabled.
Procedure
Locate the Maven
settings.xmlfile. It is usually inside the.m2directory in the user home directory. If the file does not exist, use a text editor to create it.On Linux or UNIX:
/home/<username>/.m2/settings.xml
On Windows:
C:\Users\<username>\.m2\settings.xml
Add a new profile containing the Red Hat repository to the
profileselement of thesettings.xmlfile, as in the following example.Example: A Maven
settings.xmlfile containing the Red Hat repository<settings> <profiles> <profile> <id>red-hat</id> <repositories> <repository> <id>red-hat-ga</id> <url>https://maven.repository.redhat.com/ga</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>red-hat-ga</id> <url>https://maven.repository.redhat.com/ga</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>red-hat</activeProfile> </activeProfiles> </settings>
For more information about Maven configuration, see the Maven settings reference.
Adding the repository to your POM file
To configure a repository directly in your project, add a new entry to the repositories element of your POM file, as in the following example.
Example: A Maven pom.xml file containing the Red Hat repository
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example-app</artifactId>
<version>1.0.0</version>
<repositories>
<repository>
<id>red-hat-ga</id>
<url>https://maven.repository.redhat.com/ga</url>
</repository>
</repositories>
</project>
For more information about POM file configuration, see the Maven POM reference.
B.2. Using a local repository
Red Hat provides file-based Maven repositories for some of its components. These are delivered as downloadable archives that you can extract to your local filesystem.
To configure Maven to use a locally extracted repository, apply the following XML in your Maven settings or POM file.
<repository>
<id>red-hat-local</id>
<url>${repository-url}</url>
</repository>
${repository-url} must be a file URL containing the local filesystem path of the extracted repository.
Table B.1. Example URLs for local Maven repositories
| Operating system | Filesystem path | URL |
|---|---|---|
| Linux or UNIX |
|
|
| Windows |
|
|
Revised on 2018-07-27 18:00:44 EDT

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.