0
votes

I have a Jenkins job which runs mvn clean verify on a project. But some of integration tests fail due to 2 dependencies that cannot be resolved by the Shrinkwrap resolver.

The Jenkins server and slaves are in an internal network which does not allow access to the central repository. But we have a Nexus repository which has all the required packages.

When running the Jenkins job it finishes with UNSTABLE and two failing integration tests. Both messages look like this:

Nov 17, 2017 1:02:25 PM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed WARNUNG: Failed downloading com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.7.4/jackson-datatype-jsr310-2.7.4.pom from https://repo.maven.apache.org/maven2/. Reason: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.fasterxml.jackson.datatype:jackson-datatype-jsr310:pom:2.7.4 from/to central (https://repo.maven.apache.org/maven2): Error transferring file: repo.maven.apache.org Nov 17, 2017 1:02:25 PM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed WARNUNG: Failed downloading com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.7.4/jackson-datatype-jsr310-2.7.4.pom from http://repo1.maven.org/maven2/. Reason: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.fasterxml.jackson.datatype:jackson-datatype-jsr310:pom:2.7.4 from/to central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org

To resolve this issue I added a pre build step to download the artifacts. The logs show that the artifacts were downloaded:

Resolving artifact com.fasterxml.jackson.datatype:jackson-datatype-jsr310:pom:2.7.4 Resolved artifact com.fasterxml.jackson.datatype:jackson-datatype-jsr310:pom:2.7.4 from central (, releases+snapshots)

I also checked in manually: the pom files are in the local repository.

Why can't it resolve the artifacts which are clearly inside the local repository?

2

2 Answers

1
votes

Finally I have found a way. I provide the settings.xml and set the target to "csettings.xml". Then I pass the argument to the build goals and options: "-Dorg.apache.maven.user-settings=$WORKSPACE/csettings.xml"

0
votes

Additionally if anybody need to concatenate two settings file it can be done by setting global-settings and user-settings

-Dorg.apache.maven.global-settings=global-settings.xml -Dorg.apache.maven.user-settings=user-settings.xml 

In my case this was useful in Jenkins to store configuration in global setting and credential to servers in user-setting which was stored as secret.