Search code examples
mavenjbossdroolsnexussonatype

Local Nexus repository pulls everything but the main jar through POM dependency


Our local Nexus repository seems inconsistent in downloading dependencies. It will pull down the pom, and even test jars etc... but not the main actual jar I need! So when I Browse Indexes on our Central (proxy) repository for drools-compiler: org/drools/drools-compiler I see the following files:

  • drools-compiler-6.2.0.CR4-javadoc.jar
  • drools-compiler-6.2.0.CR4-sources.jar
  • drools-compiler-6.2.0.CR4-test-sources.jar
  • drools-compiler-6.2.0.CR4-tests.jar
  • drools-compiler-6.2.0.CR4.pom

the missing crucial file being:
drools-compiler-6.2.0.CR4.jar

When I Browse Remote, everything is there including the crucial jar.

When I run mvn clean install (through my IDE STS 3.6.3), I end up seeing the following error message:

Failed to execute goal on project :
Could not resolve dependencies for project :
Failed to collect dependencies at org.drools:drools-compiler:jar:6.2.0.CR4:
Failed to read artifact descriptor for org.drools:drools-compiler:jar:6.2.0.CR4:
Failure to find org.jboss.dashboard-builder:dashboard-builder-bom:pom:6.2.0.CR4 in was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced

There are plenty of other dependencies that have been pulled down in the past, the repository has been there for a long time (I didn't set it up, just dealing now!)... the JBoss drools isn't the only time I see this, it is just my most pressing concern now.

I have googled around, some posts seem relevant, (this one is almost identical but unsolved) but can't seem to find a resolution. Remote index downloads have been setup in our local Jboss and Central proxies. I have tried clearing the cache, rebuilding the indexes, adding a "-U" to my mvn command... but to no avail. The only time I can get my project to build is when I totally bypass my local repository (empty .m2/settings.xml) and pull straight from Central or JBoss public. Does anyone have a clue on what might be happening wrong here?

UPDATE: Further detail which may help: The repository 'nexus' defined as a mirror in my settingx.xml (below) is a Group Repository, consisting of (in this order):
* Central (http://repo1.maven.org/maven2/)
* JBoss public (http://repository.jboss.org/nexus/content/groups/public/)
* Repo of our own uploaded local jars...

Following @Steve's advice, I dug deeper than the missing drools-compiler files and found that org.jboss.dashboard-builder.dashboard-builder-bom... didn't exist in Central, interestingly, but it did exist in JBoss. My understanding is that by using the Group of Repos, it should query the next repo down in the list if it doesn't find something, right? Any advice most appreciated!

settings.xml:

  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>(local server)/nexus/content/groups/public</url>
    </mirror>    
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>  
  </profiles>
  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>

POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mypackage.here</groupId>
    <artifactId>TaskLaunchManager</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>TaskLaunchManager</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <app.name>task-launch-manager</app.name>
        <log4j.version>1.2.16</log4j.version>
        <junit.version>4.8.1</junit.version>
        <drools.version>6.2.0.CR4</drools.version>
        <slf4j.version>1.7.9</slf4j.version>
    </properties>

    <!-- Drools Maven BOM (Bill of Materials) -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.drools</groupId>
                <artifactId>drools-bom</artifactId>
                <type>pom</type>
                <version>${drools.version}</version>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.kie</groupId>
                <artifactId>kie-bom</artifactId>
                <type>pom</type>
                <version>${drools.version}</version>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- Required dependencies -->
    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
        <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
            <scope>compile</scope>
        </dependency>       
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-internal</artifactId>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
        </dependency>

    </dependencies>

</project>

Solution

  • Ok, problem resolved! It took several steps, some of which are mentioned elsewhere on stackoverflow and had already been tried unsuccessfully, but the order really mattered here:

    1. The dashboard-builder artifact was not located in Maven Central proxy, but in JBoss public proxy. That proxy needed to be created locally (it had been)
    2. Since artifacts needed to be obtained from Central, as well as JBoss, a Group repo needed to be created to hold them both (it had been)
    3. In the group repo, JBoss needed to be added to it... (it had not been facepalm)... it was still listed 'Available Repositories' instead of in the 'Ordered Group Repositories'
    4. Even after adding, still the build failure persisted due to caching, not rebuilt indexes etc. I needed to force an update using the '-U' switch, as mentioned in this stackoverflow post: mvn clean install -U
    5. Even after seeing build success, in my IDE the project was still indicating the errors in the pom. This was due to m2eclipse... and was resolved with the action: Maven > Update Project... > checking 'Force update of Snapshots/Releases