Version 26

    This page provides information for JBoss developers to get started with using the JBoss Maven repositories.

     

    If you are new to Maven, you may want to first go to the Apache Maven site to learn the basics (https://maven.apache.org/).  If you are already familiar with Maven, and want to learn how to use the JBoss Maven repositories in your builds, you are in the right place.

     

    Overview

    For an overview of how the JBoss Maven repository is organized, see the wiki page Maven Repository.

     

    For new projects or a project that will be released to the JBoss Maven repository, be sure to review the Maven Project Configuration Requirements

     

    Configuring Maven to use the JBoss Repository

    Most JBoss projects have dependencies on artifacts in the JBoss repository.  The recommended URL for JBoss developers is the public repository group.

    https://repository.jboss.org/nexus/content/groups/public/

     

    This repository should be configured in your Maven user settings (~/.m2/settings.xml)  inside a profile.

    <repositories>  
        <repository>  
          <id>jboss-public-repository-group</id>  
          <name>JBoss Public Repository Group</name>  
          <url>https://repository.jboss.org/nexus/content/groups/public/</url>  
          <layout>default</layout>  
          <releases>  
            <enabled>true</enabled>  
            <updatePolicy>never</updatePolicy>  
          </releases>  
          <snapshots>  
            <enabled>true</enabled>  
            <updatePolicy>never</updatePolicy>  
          </snapshots>  
        </repository>  
      </repositories>  
      <pluginRepositories>  
        <pluginRepository>  
          <id>jboss-public-repository-group</id>  
          <name>JBoss Public Repository Group</name>  
          <url>https://repository.jboss.org/nexus/content/groups/public/</url>  
          <releases>  
            <enabled>true</enabled>  
          </releases>  
          <snapshots>  
            <enabled>true</enabled>  
          </snapshots>  
        </pluginRepository>  
      </pluginRepositories> 
    </repositories>
    

    Note: For some projects it may be necessary to add the repository configuration to the POM but this is not recommended (e.g. projects released to Maven central cannot reference external repositories).

     

    Note about updatePolicy: the example shows the update policy set to "never".  This means that if your project depends on a snapshot version of another project, Maven will not update the local repository unless you use the "-U" command line option.  The update policy can be set to whatever value works well for your project.  More information about the update policy and other repository settings are available on the Maven site.

     

    Deploy to the JBoss Repository

     

    To deploy to the repository, you will need to add your JBoss.org credentials to your settings.  The following snippet from settings.xml shows what you need to deploy to the JBoss repositories.

    <settings>  
      ...  
      <servers>  
        <server>  
          <id>jboss-snapshots-repository</id>  
          <username>jboss.org username</username>  
          <password>jboss.org password</password>  
        </server>  
        <server>  
          <id>jboss-releases-repository</id>  
          <username>jboss.org username</username>  
          <password>jboss.org password</password>  
        </server>  
      </servers>  
      ...  
    </settings>  
    

     

     

    This mirror setting will force Maven to use only a single URL for all dependency downloads.  Your username and password must be specified three times, one for each of (1) the repository group URL, (2) deployment to the snapshot repository, and (3) deployment to the releases repository.  Unfortunately, Maven does not currently have a proper way to assign multiple repository to the same credential information.

     

    Using Deprecated Artifacts

     

    The JBoss Maven repository has been reorganized to provide a cleaner and more flexible repository.  During this process many artifacts were moved to a deprecated repository.  If your build needs to continue to use these deprecated artifacts during the migration process, you can enable this repository using a profile.

     

    <profile>  
      <id>jboss-deprecated</id>  
      <repositories>  
        <repository>  
          <id>jboss-deprecated</id>  
          <name>JBoss Deprecated</name>  
          <url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>  
          <layout>default</layout>  
          <releases>  
            <enabled>true</enabled>  
            <updatePolicy>never</updatePolicy>  
          </releases>  
          <snapshots>  
            <enabled>false</enabled>  
          </snapshots>  
        </repository>  
      </repositories>  
    </profile> 
    

     

     

    More info about the deprecated repository here ( JBoss Deprecated Repository ).

     

    (Optional) Using Additional Repositories

     

    Your build may need to search additional repositories for certain builds.  For example, the maven2-brew repository (https://repository.jboss.org/maven2-brew).  This can be done with a minor change to the mirror settings, and adding the repository to a profile.

     

    First add a profile that will add the repository to your builds.

     

    <profile>  
      <id>jboss-maven2-brew</id>  
      <repositories>  
        <repository>  
          <id>jboss-maven2-brew</id>  
          <name>JBoss Maven 2 Brew Repository</name>  
          <url>https://repository.jboss.org/maven2-brew/</url>  
          <layout>default</layout>  
          <releases>  
            <enabled>true</enabled>  
            <updatePolicy>never</updatePolicy>  
          </releases>  
          <snapshots>  
            <enabled>false</enabled>  
          </snapshots>  
        </repository>  
      </repositories>  
    </profile>
    

     

    This profile can be made active automatically by adding it to <activeProfiles>

    (Optional) Mirror Settings

     

    Another option is to put the public repository into a mirror configuration in your settings.xml.  This will force Maven to download only from certain repositories.

     

    The mirror settings would look something like this.

     

    <mirror>  
      <id>jboss-public-repository-group</id>  
      <mirrorOf>*,!jboss-deprecated,!jboss-maven2-brew</mirrorOf>  
      <name>JBoss.org Public Repository Group</name>  
      <url>https://repository.jboss.org/nexus/content/groups/public/</url>  
    </mirror>  
    

     

     

    (Optional) Using JBoss Maven Plugins

     

    Several JBoss projects include Maven plugins.  You can add configuration to your settings.xml which will allow Maven to use shorthand notation when referring to these plugins.

     

    <pluginGroups>  
        <pluginGroup>org.jboss.maven.plugins</pluginGroup>  
    </pluginGroups>  
    

     

    Example Settings

     

    A complete example of settings.xml is also available ( Maven Settings Example - Developers ).

     

    Deploying Projects to the Repository

     

    You project pom.xml must be configured with the correct distributionManagement information in order to deploy to the repository.  There are several deployment scenarios in the normal development process.

     

    Maven Deploying a Snapshot

     

    Maven Deploying a JBoss Project Release or a patched/rebuilt thirdparty project

     

    Uploading a Thirdparty Artifact

     

     

     

    Using Thirdparty Maven Repositories

     

    The JBoss repository will automatically proxy artifacts from several thirdparty repositories.  The current list of proxy repositories can be seen by logging in to the Nexus interface ( https://repository.jboss.org/nexus ).

     

    If you would like to request additional thirdparty repositories to be proxied, please create a jira issue under the JBBUILD project.

     

    .