maven can't get dependency from transitive repository (sometimes)

552 views Asked by At

I have following problem which sounds pretty crazy. I have a project A, which uses Lib B which uses Lib C. Lib C isn't in central. Lib B has a parent which defines a repository in which lib C can be found. Depending on mvn version and maybe some other spices it works or not. The project is question is MoSKito: https://github.com/anotheria/moskito. MoSKito has a dependency to xchart (com.xeiam.xchart:xchart 2.5.0). xchart uses VectorGraphics2D (de.erichseifert.vectorgraphics2d:VectorGraphics2d:0.9.1). VectorGraphics2D is not in central.

xchart has defined VectorGraphics2D's dependency in its parent (com/xeiam/xchart/xchart-parent/2.5.0/xchart-parent-2.5.0.pom):

    <repositories>
            <repository>
                    <id>erichseifert.de</id>
                    <url>http://mvn.erichseifert.de/maven2</url>
            </repository>
    </repositories>

Now back to original problem: When I build MoSKito on my machine VectorGraphics2D is downloaded from http://mvn.erichseifert.de/maven2. I see it in my build log and also it is present in repository and the file _remote.repositories contains following content:

#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
#Wed Oct 28 16:18:30 CET 2015
VectorGraphics2D-0.9.1.jar>erichseifert.de=
VectorGraphics2D-0.9.1.pom>erichseifert.de=

If someone else builds MoSKito the file is not downloaded and the error message is

   [ERROR] Failed to execute goal on project moskito-webui: Could not resolve 
dependencies for project net.anotheria:moskito-webui:jar:2.6.4-SNAPSHOT: Failure
 to find de.erichseifert.vectorgraphics2d:VectorGraphics2D:jar:0.9.1 in
 http://nexus.locale/nexus/content/groups/provided was cached in the local
 repository, resolution will not be reattempted until the update interval of nexus
 has elapsed or updates are forced -> [Help 1]

Is there any settings which can be made to resolve this issue, so it is at least deterministic?

P.S. whoever marked this question as duplicate of maven force update dependencies question, it has nothing to do with dependencies update. It is about maven resolving an artifact from a repository which is specified in a referenced project. Sometimes it works and sometimes it doesn't.

1

There are 1 answers

0
Leon On

Ok, I found it out, and posting the answer here for traces. The system which couldn't download the artifact had an active mirror in their settings.xml with

<mirrorOf>*</mirrorOf>

This prevented mvn to download artifact from linked repository, and the mirror didn't now what's happening and couldn't download the artifact. We solved the issue in two ways (two different machines): 1) change mirrorOf from * to central 2) Manually upload the artifact as 3rd party artifact in the mirror nexus (proxy would do it too, probably)

Thank you and good luck ;-)