How to ensure dep retrieved from repository?

Consider the following case:

  • repo A builds an artifact A.jar
  • repo B depends on A.jar

During our build process, A.jar is build first and the result is published to a artifact repository. Afterwards, build of B is executed.

However, during development, a dev wants to add stuff to A and directly use it in B. So he can’t wait for an official build. Instead, he uses

gradle install

to publish the own A.jar to his local maven repo. Please note, version numbers won’t change as we don’t have versions for individual components, but just for our overall product suite.

How can we ensure that afterwards when working on B, the artifact from his local repo is used? During development, gradle should check each time for differing artifacts in the following order and stop as soon as it found a newer one:

  • local
  • artifact repository

However, the build process should skip local, because it is ensured that the latest version of A is in the repository when building B.

I thought about the following repository configuration:

repositories {
    maven { url "http://artifactrepo:8081/content/repositories/ownstuff/" }
  • Does that ensure that a locally build B will be used if it is newer than the one in the repo?
  • How do I skip mavenLocal() on an official build?

What’s the official way of doing that?

You might be interested in [this] (