Using Release Repo as default and Develop Repository as Fallback

Hi there,

The version which is used is the 7.5.1
end Edit1:

currently I am trying to resolve same artifact Names on different Repositories.

One Repo is our Develop repository and is only hosting like version 2.1.0-TIMESTAMP something.
The other Release Repository is only hosting the real versions like 2.1.0.

My issue right now is

If I try to resolute the release repository first in the list of possible Repositories it will tell me all fine. But if I resolute the dev repository first it will tell me the version 2.1.0 not found in repository.

current repo paths in order:

        createRepository(project, "gradle-dev")
        createRepository(project, "gradle-release")
        createRepository(project, "netbeansMaven2")
        createRepository(project, "jcenter")
        createRepository(project, "maven2")
        createRepository(project, "gradleplugin")

Well gradle is right about that current version availability is:

dev repo:

  • 2.2.0-TIMESTAMP
  • 2.3.1-TIMESTAMP
  • and more

release repo:

  • older stuff
  • 2.0.0
  • 2.1.0
  • 2.2.0

is there any possible fallback repository to look? I searched in gradle documentation and the only thing I found was:

“* Once a repository returns a metadata result, following repositories are ignored.”


Appreciate any help :smiley:

It does not only tell that it was not found, it also tells you where it looked.
Does it list both repos?
Usually, if you request 2.1.0 and it doesn’t find it in the first repo, it will look in the next repo.
Just if you for example use some dynamic version like 2.+ it will not look in the second repo when it already found a matching version in the first repo.
Can you maybe share a build --scan?

thanks for the fast response.

sadly it only looks in the first listed if I run it with --scan it will list the exception com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not find Artifact-2.13.0
searched in following locations:

  • gradle-dev

gradle release is never searched for

I guess it is because of the maven-metadata.xml in this repo which lists the same name in both repositories and gradle will just say:

okay I found your artifact with correct group and name but the version is missing therefor I will throw an exception.

As I said, if it does not find the version, it looks in the next defined repository.
If it only looks in gradle-dev and nothing more, it seems you did not define those other repositories.

this is the code snippet

        project.repositories.forEach {
            log.error("url") as String)

and the logged out lines of repositories:


so no. All Repositories are defined and listed from the project.

Found a Solution:

just update to gradle 7.6.3 and it will use the intended Repository solution search.

1 Like