What is the best practice to follow when you have multiple local and remote repositories?

If you have configured Artifactory to resolve from a single virtual repository that is aggregating all of your remote repositories, this could result in certain builds trying to resolve dependencies from irrelevant remote repositories.

The best practice would be to create a number of virtual repositories, each one per build, project or team (depending on your needs), and with each one containing only the relevant repositories (local and remote) to that project. This way, when running a build, you avoid searching through irrelevant repositories in Artifactory.

Of course, if you have a very big project that needs to download dependencies from many repositories, then there is not much choice but to include all of them into the virtual repository. In such a case, using the include/exclude patterns would be helpful to control resolution order.

For example: If you have a project that resolves dependencies from the following paths:

  1. org/jfrog/a

  2. org/jfrog/b

These dependencies are located in the repositories repoA and repoB (where repoA holds only org/jfrog/a artifacts and repoB holds only org/jfrog/b artifacts), it would make sense to exclude org/jfrog/a from repoB and exclude org/jfrog/b from repoA; This way, Artifactory will not try to send unnecessary queries and will save up on resolution time.