Maven Getting Started - Users

This page provides information for JBoss Community users to get started with the JBoss.org Maven repository.

 

If you are new to Maven, you may want to first go to the Apache Maven site (http://maven.apache.org/) to learn the basics.  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.

 

Introduction

 

The JBoss community Maven repository is actually a set of repositories host by Nexus.  This consists of hosted repositories (artifacts released by the JBoss community team) and a repository group (virtual repository that contains other repositories).

 

Note: all of the repositories have the base URL: https://repository.jboss.org/nexus/content/

Hosted Repositories

  • JBoss Releases ( repositories/releases ) - JBoss community projects that have been released
  • JBoss Thirdparty Releases ( repositories/thirdparty-releases ) - Thirdparty projects that have been modified and rebuilt by the JBoss community
  • JBoss Thirdparty Uploads ( repositories/thirdparty-uploads ) - Thirdparty artifacts which are not available via the proxied repositories.  These are uploaded directly to the repository.
  • JBoss Deprecated ( repositories/deprecated ) - Artifacts from the jboss repository that should no longer be used but need to be available for legacy builds
    • Contains artifacts which have been copied from central but moved to a new groupId
    • Contains artifacts that match a GAV from central, but the artifacts are not identical
  • JBoss Snapshots ( repositories/snapshots ) - JBoss community project snapshot builds

 

Repository Group

  • Public ( groups/public ) - Virtual repository that groups together all of the above repositories except for jboss deprecated.

 

Depending on the needs of your project, you can choose to configure your Maven settings using any of the direct URLs.  The recommended configuration described in this page is to use the public group URL that will allow access to most of the JBoss artifacts through a single interface.

 

Note that many JBoss projects require artifacts from the central Maven repository (http://repo1.maven.org), this repository is automatically available to Maven builds.  Depending on the project you are using, you may need to configure additional repositories in your settings.xml.

 

Using the Repository Web Interface

 

The web interface is available at https://repository.jboss.org/nexus and it available to all users.  The web interface displays all the available repositories and their relevant URLs.  The web interface provides the ability to search for and locate artifacts.

 

Configuring Maven to use the JBoss Repository

The repository now has a single repository group URL that can be used to download artifacts from multiple repositories.

 

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

 

To use dependencies from the jboss.org repository this URL will need to be added to your Maven settings.  The following snippet should be included in settings.xml to use the JBoss repository.

 

This xml file will be in your .m2 directory. If there isn't one of these files (by default there isn't) then simply create it and copy in the snippet below.

 

 

<settings>
  ...
  <profiles>
    ...
    <profile>
      <id>jboss-public-repository</id>
      <repositories>
        <repository>
          <id>jboss-public-repository-group</id>
          <name>JBoss Public Maven 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 Maven 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>
        </pluginRepository>
      </pluginRepositories>
    </profile>

  </profiles>

  <activeProfiles>
    <activeProfile>jboss-public-repository</activeProfile>
  </activeProfiles>
  ...
</settings>

 

This will add the JBoss repository to a profile which will be active by default during your builds.  As long as the profile is active, your Maven build will be able to download dependencies from the JBoss repository.  If you want to deactivate this profile for a specific build (to avoid using the JBoss repository), this can be done using the standard Maven command line syntax for deactivating a profile.

 

mvn -P-jboss-public-repository install

 

For a detailed description of the options available in the Maven settings, see the Maven settings reference.

 

Using Deprecated Dependencies

 

The JBoss Maven repository has been restructured to provide a cleaner better organized repository.  As a result, many artifacts have been moved into a deprecated Maven repository and should no longer be used.  If your build requires a dependency that can only be found in the deprecated repository, you should notify the project team.  To use the deprecated artifacts, simply add an additional profile to your settings.

 

 

    <profile>
      <id>jboss-deprecated-repository</id>
      <repositories>
        <repository>
          <id>jboss-deprecated-repository</id>
          <name>JBoss Deprecated Maven Repository</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>
            <updatePolicy>never</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
    </profile>

 

Using JBoss Maven Plugins

 

Several JBoss projects include Maven plugins.  Optionally, you can add configuration to your settings.xml which will allow Maven to use shorthand notation for jboss plugins.

 

 

  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
     | -->
    <pluginGroup>org.jboss.maven.plugins</pluginGroup>
  </pluginGroups>

Example

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

 

Questions/Problems

If you have issues using the suggested repository configuration, please post your questions to the build forum ( http://community.jboss.org/en/build?view=discussions ), or ask for help on IRC ( #jboss at irc.freenode.net )

 

.