Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support providing alternate repositories for version lookup #98

Closed
JakeWharton opened this issue Apr 7, 2016 · 3 comments
Closed

Support providing alternate repositories for version lookup #98

JakeWharton opened this issue Apr 7, 2016 · 3 comments

Comments

@JakeWharton
Copy link

We use Sonatype Nexus as read-through proxy for Maven Central and other external repositories. As such, all our builds only point at that internal proxy and it only contains the versions that have been previously requested.

It would be great if we could specify additional repositories for looking up versions of artifacts. This would let us look at versions in the upstream repo but still only fetch our actual dependencies through the proxy.

Maybe something like:

dependencyUpdates {
  repositories += [mavenCentral(), 'http://example.com/repo/']
}
@ben-manes
Copy link
Owner

I've done the same previously with Artifactory's virtual repository. It would query the backing repositories to search, cache within a short time frame, and I hadn't observed any issues. It sounds like a bug in Sonatype or the configuration, since Maven's versions:display-dependency-updates uses a similar lookup strategy.

Unfortunately Gradle's RepositoryHandler is extremely buggy due to its flawed deduping. That results in either dropping repositories on a "name" conflict or adding the same multiple times and slowing the resolution. Previously I aggregated all repositories found to cast the widest net, but because of that I refrain from touching it. Instead I use whatever is associated with the configuration. So adding this would probably require trying to work around this bug and might be error prone.

Since repositories are (edit: not) strictly coupled into configuration phase, you can do this yourself dynamically. You might still run into the deduping bug, so I'd name all of your additions explicitly.

tasks.dependencyUpdates.doFirst {
  repositories {
    maven { url 'https://a.b.c' }
  }
}
$ gradle dU -i
...
Resolving caffeine project (root) configurations with repositories:
 - maven: https://jitpack.io
 - MavenRepo: https://repo1.maven.org/maven2/
 - BintrayJCenter: https://jcenter.bintray.com/
 - maven2: https://a.b.c

@JakeWharton
Copy link
Author

Great tip. I'll give it a try.

@ben-manes
Copy link
Owner

wonderful, really glad that worked out for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants