2
votes

In my build.gradle for a Java project, I have a list of Maven repositories I am pointing to for dependency resolution, as follows:

repositories {

maven {                                                                                                                                                                                                 
    url "https://artifactory.myco.com/artifactory/maven-us-east-1-local"      

}                                                                                                                                                                                                       
maven {                                                                                                                                                                                                 
    url "https://artifactory.myco.com/artifactory/maven_snapshots-us-east-1-local"

}                                                                                                                                                                                                       
mavenCentral()                                                                                                                                                                                           }

It looks like the snapshots repo above barfs during resolution when gradle tries to see if a non-snapshot dependency lives there, as it goes through and contacts each repo in order. In artifactory it has been configured with a policy and it sends back a 409 conflict when it gets asked if it has a non-snapshot dependency. This is what I get:

./gradlew build . . . FAILURE: Build failed with an exception.

Is there a way in gradle to tell it to not bother contacting that repo for non-snapshot dependencies? In Maven you can add extra properties in a repository declaration telling Maven whether it allows release dependencies, snapshot dependencies, or both (the default).

Thanks.

1

1 Answers

0
votes

I have similar issues with Gradle 4.x and 5.x, the workaround is to use Gradle 2.x. By using Gradle 2.x does not stop Gradle search non-snapshot libs from release repository, but at least Gradle can find decency.