BPMS 6 fails to resolve dependencies when using Sonatype Nexus as Artifact Repository

Solution Verified - Updated -

Environment

  • Red Hat JBoss Business Process Management Suite (BPMS)
    • 6.x

Issue

BPMS fails to retrieve dependencies from Nexus Sonatype artifact repository with the following message:

Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact com.fasterxml.jackson.core:jackson-core:pom:2.3.1 from/to anonymous (https://nexus.example.com/nexus/content/groups/example): No connector available to access repository anonymous (https://nexus.example.com/nexus/content/groups/example) of type  using the available factories FileRepositoryConnectorFactory, WagonRepositoryConnectorFactory
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538) [aether-impl-1.13.1.jar:]
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216) [aether-impl-1.13.1.jar:]
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193) [aether-impl-1.13.1.jar:]
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281) [maven-aether-provider-3.0.5.jar:3.0.5]
    ... 70 more

And the preemptive authentication is already configured in the settings.xml but the issue continue:

<servers>
    <server>
    <id>nexus</id>
    <username>REDACTED</username>
    <password>REDACTED</password>
    <configuration>
          <wagonProvider>httpclient</wagonProvider>
              <httpConfiguration>
             <all>
                <usePreemptive>true</usePreemptive>
             </all>
           </httpConfiguration>
      </configuration>
    </server>
</servers>

And through wget command it is possible to retrieve the artifact.

Resolution

It is necessary to add the layout tag in the mirror configuration:

<mirrors>
      <mirror>
           <id>anonymous</id>
           <mirrorOf>*</mirrorOf>
           <url>https://nexus.example.com/nexus/content/groups/example</url>
           <layout>default</layout>
      </mirror>
</mirrors>

Root Cause

The output from Sonatype that initiated the discovery was of type using the. After seeing that no type was specified we looked through the source code and traced the missing value (it was being verified by the WagonRepositoryConnector). Through more investigation we saw that this value was being pulled from the mirrored repository in the settings.xml (which, according to maven, has a default value of default for type). By explicitly adding this value in the settings.xml the issue was solved.

You can reach the settings.xml file attached in this article to use as example.

Attachments

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments