Maven Getting Started - Developers

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.  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.

 

Configuring Maven to use the JBoss Repository

When developing JBoss projects, it is important that all project dependencies are available via the JBoss repository.  In order for your build to use artifacts from the JBoss Maven repository and to save artifacts from remote repositories, you will need to configure your build to use the developer repository group which will automatically include several remote repositories.  The following snippet from settings.xml shows what you need to use the JBoss repositories.

 

 

<settings>
  ...
  <servers>
    <server>
      <id>jboss-developer-repository-group</id>
      <username>jboss.org username</username>
      <password>jboss.org password</password>
    </server>
    <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>
  ...
  <mirrors>
    <mirror>
      <id>jboss-developer-repository-group</id>
      <mirrorOf>*,!jboss-deprecated</mirrorOf>
      <name>JBoss.org Developer Repository Group</name>
      <url>https://repository.jboss.org/nexus/content/groups/developer/</url>
    </mirror>
  </mirrors>
</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>

 

(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 Release

 

Coming soon: Uploading a thirdparty jar

 

Coming soon: Uploading a license restricted jar (for example some Sun jars)

 

 

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.