New Maven configuration for Mobicents source builds

Mobicents Source

 

Mobicents source build depend on JBoss maven repositories and artifacts stored in them(Or atleast is should be).

Sometime ago JBoss maven repositories structure has been changed, the nexus has been born. This enforced changes in maven configuration.

 

For trunk users this change is transparent, since projects source has been updated to refer proper repositories. However previously released source is affected by this change.

 

 

 

 

The Symptom

Symptom of failure is inability to find some artifacts in current repository. For some reason part of artifacts have been moved to separate repository(deprecated). Example failure output will look like one below:

 


[ERROR] Failed to execute goal on project mobicents-slee-example-xcap-client-sbb: Could not resolve dependencies for project org.mobicents.examples:mobicents-slee-example-xcap-client-sbb:jar:2.0.0-SNAPSHOT: Failed to collect dependencies for [org.mobicents.resources:mobicents-slee-ra-xcap-client-ratype:jar:2.4.1.FINAL (compile), org.mobicents.examples:mobicents-slee-example-xcap-client-library:jar:2.0.0-SNAPSHOT (compile), org.jboss.jbossas:jboss-as-server:jar:jmx-invoker-adaptor-client:5.1.0.GA

 (compile), org.mobicents.slee.enabler.userprofile:user-profile-jmx:jar:1.0.0.CR1 (compile)]: Failed to read artifact descriptor for jpl-pat
tern:jpl-pattern:jar:1.0: Could not transfer artifact jpl-pattern:jpl-pattern:pom:1.0 from repository.jboss.org 
 (http://repository.jboss.org/maven2): Access denied to: http://repository.jboss.org/maven2/jpl-pattern/jpl-pattern/1.0/jpl-pattern-1.0.pom

 -> [Help 1]

 

 

 

    

 

The Fix

To fix this problem one simply needs to edits $USER.HOME/.m2/settings.xml and add deprecated repository:

 

1. Seek profile section and add following profile

 

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

 

 

2. Seek <activeProfiles> element(or create on at direct child of root elements of settings.xml file) and add profile activation:

 

 

<activeProfile>jboss-deprecated-repository</activeProfile>

 

 

 

JBoss Nexus

Just for sake of giving complete fix. In case project fails to build with similar error as below:

 

 

 

One needs to add JBoss nexus repository(this is caused by project/example not beeing update). Nexus repository definition can be found below:

 

 

     
    <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-jboss/
</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-jboss/
</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

 

 

To activate it use the same tachique as to deprecetated repository, simply add entry with following value: jboss-public-repository