Search code examples
gradleartifactorynexus

Is there a way in Gradle to define what patterns of artifacts should, (or should not), be resolved via a repository?


Is there a way in Gradle to explicitly define where certain artifacts should be coming from?

We have a legacy project which is being on-boarded to use a proper artifact repository manager, instead of a network share. However, we have multiple repositories from which artifacts are being downloaded. We'd like to be able to fine-grain where certain artifacts should be coming from, until we can fully on-board to the artifact repository manager in question.

Is something like this possible?


Solution

  • Yes that is possible as of Gradle 5.1

    https://docs.gradle.org/5.1/release-notes.html#repository-to-dependency-matching

    Repository to dependency matching

    It is now possible to match repositories to dependencies, so that Gradle doesn't search for a dependency in a repository if it's never going to be found there.

    See the docs for more details: https://docs.gradle.org/5.6.2/userguide/declaring_repositories.html#sec::matching_repositories_to_dependencies