Gradle-versions-plugin's version resolution is interfered by resolutionStrategy
See original GitHub issueI’m troubleshooting BEAM-8654 where BEAM’s dependency update check does not see newer versions available in Maven Central.
By trimming irrelevant components, I managed to create minimum code to reproduce the problem:
My build.gradle"
plugins {
id 'java'
id "com.github.ben-manes.versions" version "0.27.0"
}
group 'suztomo'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "com.google.cloud.bigtable:bigtable-client-core:1.8.0"
}
// This resolutionStrategy is not intended for Gradle versions plugin, but to
// prefer Beam project's recommended versions to Gradle's default reoslution
// algorithm
configurations.compile.resolutionStrategy {
force(["com.google.cloud.bigtable:bigtable-client-core:1.8.0"])
}
This shows:
> Task :dependencyUpdates
------------------------------------------------------------
: Project Dependency Updates (report to plain text file)
------------------------------------------------------------
The following dependencies are using the latest milestone version:
- com.github.ben-manes.versions:com.github.ben-manes.versions.gradle.plugin:0.27.0
- com.google.cloud.bigtable:bigtable-client-core:1.8.0
...
However, com.google.cloud.bigtable:bigtable-client-core
has newer version 1.12.1 in Maven Central.
The resolutionStrategy
statement is not for Gradle versions plugin. This has been added to Beam’s build.gradle to pick up Beam’s preferred library versions rather than Gradle’s default dependency resolution algorithm(as per the comment in BeamModulePlugin). Unfortunately this resolutionStrategy
is interfering Gradle versions plugin and prevents it from reporting the latest versions of its libraries.
Do you know good way to avoid this interference?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Gradle changes quite a bit so maybe that trick doesn’t work anymore.
You can also try
gradle.startParameter.taskName
,I seem to have discovered an issue with this workaround
It seems that this causes ben-manes to not know what versions of the project we’re currently using.
I just noticed today, with this scenario:
0.8.3
resolutionStrategy
to force jacoco0.8.7
. I see this works by running the./gradlew :module:dependencies
taskI don’t know if this is an issue specific to the way that android gradle plugin brings in jacoco. Perhaps it’s not the way most library dependencies work…