We have a company-wide Nexus 3 server which
The developers use two repositories:
Both repositories are used in a Gradle build:
repositories {
maven {
name "snapshots"
url "http://nexus3.server:8081/repository/maven-snapshots"
}
maven {
name "releases"
url "http://nexus3.server:8081/repository/maven-releases"
}
}
Now when Gradle tries to resolve a snapshot-dependency it asks the releases-repository, Nexus answers with
Error 400 Bad Request
Repository version policy: RELEASE does not allow version: 1.0-SNAPSHOT
and the build fails with
> Could not resolve group.id:artifact-id:1.0-SNAPSHOT.
Required by:
:my-project:unspecified
> Could not resolve group.id:artifact-id:1.0-SNAPSHOT.
> Could not get resource 'http://nexus3.server:8081/repository/maven-releases/group/id/artifact-id/1.0-SNAPSHOT/artifact-id-1.0-SNAPSHOT.pom'.
> Could not GET 'http://nexus3.server:8081/repository/maven-releases/group/id/artifact-id/1.0-SNAPSHOT/artifact-id-1.0-SNAPSHOT.pom'. Received status code 400 from server: Bad Request
How do I need to configure Gradle so that this error is ignored and the next repository ("snapshots") is tried? Or is it possible to configure Nexus to return 404 Not Found instead of 400 Bad Request?
Version: Gradle 2.9
Check out the Nexus Repository Manager 3 documentation for gradle usage as well as the example projects. That should show you how to use a init.gradle for downloading from the repository group.
RaGe's comment was a good hint: The dependency was neither in snapshots
nor in releases
but in a third repository which I was not aware of. After adding the third repository to Gradle the dependency was resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With