Question

We have a master - slave repository approach set up with nexus pro as a master and a nexus pro as slave, where our snapshot and releases repositories are configured to be proxied (moreover using the smartproxy technology from sonatype nexus).

Our project is a multiproject build which is based upon Gradle and Ivy. We use dynamic versions (e.g. 1.+) to define and resolve dependencies.

The problem is that an artifact can't be resolved on a proxy, that has correctly beeing published to the master repository and is not beeing forwarded to the slave (proxy) repository (e.g. due to network problems or the fact that a slave repository can be set up after the publishing of the given artifact).

As I found out (see docu in gradle), the gradle dependency resolver uses directory listing:

If the dependency is declared as a dynamic version (like 1.+), Gradle will resolve this to the newest available static version (like 1.2) in the repository. For Maven repositories, this is done using the maven-metadata.xml file, while for Ivy repositories this is done by directory listing.

Unfortunately since that artifact and the directory structure is not available, the process of resolution fails. Calling gradle --info --refresh-dependencies results to

Executing task ':resolve' (up-to-date check took 0.001 secs) due to:
Task has not declared any outputs.
Resource missing. [HTTP GET:     http://proxy/nexus/content/repositories/testrepo/com/company/smpro/test/SmartproxyTest/]
:resolve FAILED
:resolve (Thread[main,5,main]) completed. Took 0.668 secs.

I would have thought that the Nexus is resolving that URL on the master where the artifact list would be available through a directory listing, but it doesn't. If I put the upper URL into the browser, I get 404:

404 - ItemNotFoundException
Request is marked as local-only, remote access not allowed from M2Repository(id=testrepo)

If I call it on the master repo, it works of course.

My question now: Has anybody any clue, why this can't be resolved at the master via the proxy, which it should normally do?

Thanks, Fred

Was it helpful?

Solution

Nexus proxy repositories populate their local disk storage in response to requests for files that are on the remote. Only the file(s) which have requested through the proxy are stored in it's disk cache.

So resolution by directory listing through a proxy isn't going to work very well.

From the path of your request it looks like you might be using the Nexus Professional smart proxy feature. If so, you can partially work around this by selecting "download updated artifacts immediately" in the "smart proxy" tab of the proxy. This won't work for artifacts which haven't already been downloaded though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top