MavenSettings

This page describes the JBoss specific configuration that can/should be put into the maven settings file.  This file can be created in your home directory under .m2 (~/.m2/settings.xml) for user specific settings, a default settings.xml is located in $MAVEN_HOME/conf/settings.xml for settings specific to that maven installation. An example settings.xml file configured for jboss builds can be found here: MavenSettingsExample. The settings.xml in your home directory will override the settings in the maven config directory.

 

An example settings.xml file configured for jboss builds can be found here: MavenSettingsExample

 

More details about the maven settings files can be found here.

 

To enable snapshot deployments, you will need to add your credentials for uploading via webdav.

 

    <server>
      <id>jboss-snapshots</id>
      <username>jboss.org username</username>
      <password>password</password>
      <configuration>
        <httpConfiguration>
          <put>
            <params>
              <param>
                <name>http.authentication.preemptive</name>
                <value>%b,true</value>
              </param>
            </params>
          </put>
        </httpConfiguration>
      </configuration>
    </server>

 

You're username and password are linked to your jboss.org account (jira, svn, etc).

 

To enable release deployments, you will need a similar configuration for the releases repository.

 

 <server>
   <id>jboss-releases</id>
   <username>jboss.org username</username>
   <password>password</password>
   <configuration>
     <httpConfiguration>
       <put>
         <params>
           <param>
             <name>http.authentication.preemptive</name>
             <value>%b,true</value>
           </param>
         </params>
       </put>
     </httpConfiguration>
   </configuration>
 </server>

 

Note the <httpConfiguration> section of the server config tells Maven to send auth information along with the artifacts being uploaded.  This is required for Maven 2.2.0 and higher due to MNG-4301.

 

To use the jboss repositories, you will have to define a profile that contains the repository configuration.  This repository configuration profile can be turned off by setting the property "-Djboss.repository.off" when running maven.

 

On the default example, there is a profiles section... add the following inside the profiles:

    <profile>
      <id>jboss.repository</id>
      <activation>
        <property>
          <name>!jboss.repository.off</name>
        </property>
      </activation>
      <repositories>
        <repository>
          <id>repository.jboss.org</id>
          <url>http://repository.jboss.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>snapshots.jboss.org</id>
          <url>http://snapshots.jboss.org/maven2</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>repository.jboss.org</id>
          <url>http://repository.jboss.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
        <pluginRepository>
          <id>snapshots.jboss.org</id>
          <url>http://snapshots.jboss.org/maven2</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

 

You may also need to set some properties to be shared by projects.

 

    <profile>
      <id>local-properties</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <ydoc.home>${user.home}/ydoc</ydoc.home>
        <java14_home>/usr/java/j2sdk1.4.2_13</java14_home>
        <jbossretro.site.root>${user.home}/projects/jbossretro-site/freezone</jbossretro.site.root>   
        <maven-jdocbook-plugin.site.root>${user.home}/projects/maven-jdocbook-plugin-site/freezone</maven-jdocbook-plugin.site.root>
      </properties>
    </profile>

 

Note: If you applied a wrong setting before, and you're getting few errors after fixing your settings file, try restarting your shell, as some variable might be set causing some unexpected behaviors.

 

 

Using only the jboss repository

 

If you want maven to use only the jboss repository and no others, you can use the mirror configuration to do this.

 

  <mirror>
    <mirrorOf>*</mirrorOf>
    <name>jboss-repository</name>
    <url>http://repository.jboss.org/maven2</url>
    <id>jboss-repository-mirror</id>
  </mirror>

 

This will tell maven that you want to use the jboss repository as a mirror of all other repositories.

 

 

 

 

 

 

 

 

 

 

 

 

 

Referenced by: