We are publishing artifacts to an Ivy repository in Artifactory. We have the requirement that new versions of jars are only published if they have changed from the previous version. Whether an artifact has changed is determined by a separate in-house tool with its own set of rules. The tool simply takes the previous and current jars and compares them.
I was assuming I could grab the previous jar by simply resolving the ‘latest.integration’ version of the current artifact from the repo since the new one hadn’t been published yet:
task difference {
project.configurations {
differencing
}
project.dependencies {
differencing "$project.group:$project.name:latest.integration"
}
doLast {
println project.configurations.differencing.singleFile
}
}
When I run this task, the result of the configuration resolve always points to the output of the current project’s jar task (whether that jar exists yet or not). This is true no matter what version I request, so it appears Gradle is short-circuiting the resolve if the group and name match a current project of the build.
I understand why Gradle might do that, such as someone accidentally adding an artifact dependency on a subproject rather than an explicit project dependency. Is there a way i can bypass this behavior and resolve a previous version?