How to add the JBoss Maven Repository to Maven

JBoss Logo

I am following a JBoss course on Edx, but I had a problem that had never occurred to me before with Maven. Maven could not find the dependencies to build the example test project.

The error I got looked like this:

[INFO] Scanning for projects…
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Failure to find org.jboss.bom:jboss-eap-javaee7-with-tools:pom:7.0.2.GA in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ com.redhat.training:parent-pom:1.0, D:\git\JB083x-lab\labs\pom.xml, line 35, column 16
[ERROR] Non-resolvable import POM: Failure to find org.jboss.eap:wildfly-ejb-client-bom:pom:7.0.2.GA-redhat-1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ com.redhat.training:parent-pom:1.0, D:\git\JB083x-lab\labs\pom.xml, line 43, column 16
[ERROR] 'dependencies.dependency.version' for javax.enterprise:cdi-api:jar is missing. @ line 25, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar is missing. @ line 33, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:jar is missing. @ line 41, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar is missing. @ line 49, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:jar is missing. @ line 57, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar is missing. @ line 63, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-validator:jar is missing. @ line 72, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-search-orm:jar is missing. @ line 84, column 25
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-entitymanager:jar is missing. @ line 90, column 26
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.faces:jboss-jsf-api_2.2_spec:jar is missing. @ line 98, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar is missing. @ line 104, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-jpamodelgen:jar is missing. @ line 112, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-validator-annotation-processor:jar is missing. @ line 120, column 21
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.redhat.training:hello-web:1.0 (D:\git\JB083x-lab\labs\hello-web\pom.xml) has 15 errors
[ERROR] Non-resolvable import POM: Failure to find org.jboss.bom:jboss-eap-javaee7-with-tools:pom:7.0.2.GA in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ com.redhat.training:parent-pom:1.0, D:\git\JB083x-lab\labs\pom.xml, line 35, column 16 -> [Help 2]
[ERROR] Non-resolvable import POM: Failure to find org.jboss.eap:wildfly-ejb-client-bom:pom:7.0.2.GA-redhat-1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ com.redhat.training:parent-pom:1.0, D:\git\JB083x-lab\labs\pom.xml, line 43, column 16 -> [Help 2]
[ERROR] 'dependencies.dependency.version' for javax.enterprise:cdi-api:jar is missing. @ line 25, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar is missing. @ line 33, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:jar is missing. @ line 41, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar is missing. @ line 49, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:jar is missing. @ line 57, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec:jar is missing. @ line 63, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-validator:jar is missing. @ line 72, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-search-orm:jar is missing. @ line 84, column 25
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-entitymanager:jar is missing. @ line 90, column 26
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.faces:jboss-jsf-api_2.2_spec:jar is missing. @ line 98, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar is missing. @ line 104, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-jpamodelgen:jar is missing. @ line 112, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-validator-annotation-processor:jar is missing. @ line 120, column 21
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

I googled a bit and I was not able to find a straight solution, but eventually I was able to have Red Hat Code Ready Studio add the JBoss Repository for me.

How to add the JBoss repository with Code Ready Studio

Otherwise you can do it manually creating the file settings.xml inside your $HOME/.m2/ directory in Linux or inside %USERPROFILE%.m2\ in Windows.

This is the generated file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <profiles>
    <profile>
      <id>redhat-ga-repository</id>
      <repositories>
        <repository>
          <id>redhat-ga-repository</id>
          <name>Red Hat GA repository</name>
          <url>http://maven.repository.redhat.com/ga/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
            <updatePolicy>daily</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>redhat-ga-repository</id>
          <name>Red Hat GA repository</name>
          <url>http://maven.repository.redhat.com/ga/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
            <updatePolicy>daily</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>redhat-ga-repository</activeProfile>
  </activeProfiles>
</settings>

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.