We are using gradle as a build tool and sonatype nexus to store project thirdparty and public artifacts.
There was a recent update to a public artifact say com.abc:cde:3.4.2, wherein our project uses com.abc:cde:3.4.1
However, during the build execution, gradle pulls the latest version of the artifact even though the build is explicitly specified to download only 3.4.1
compile 'com.abc:cde:3.4.1'
Is there a way to download only specific version of dependency even though nexus has the latest version of artifacts
You can force version numbers by using a resolution strategy on a configuration.
e.g.
configurations.compile {
resolutionStrategy {
force 'com.abc:cde:3.4.1'
}
}
Check out https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html for more information.