refreshVersions
refreshVersions copied to clipboard
0.9.5-dev-009: Vanishing plugin versions
I have a couple of Gradle plugins in buildSrc whose versions I'd like to manage through versions.properties. Configuring the tool versions of the plugins, like for the Jacoco plugin, here
configure<JacocoPluginExtension> {
toolVersion = "_" // managed by versions.properties
}
and running the respective task seems to work on first sight, the plugin automatically adds
version.org.jacoco..org.jacoco.agent=0.8.5
## # available=0.8.6-SNAPSHOT
to my versions.properties. Now, when I run refreshVersions next time however, these entries seem to get removed from the file. I've found that the same also happens with other plugins, such as the gradle-cpd-plugin, which configures the CPD distribution like this:
configure<CpdExtension> {
toolVersion = "_" // managed by versions.properties
}
This will at first add
version.net.sourceforge.pmd..pmd-dist=6.26.0
## # available=6.27.0-SNAPSHOT
## # available=7.0.0-SNAPSHOT
which gets removed in a later refreshVersions call.
On a related note: One could now say that for Jacoco, instead of specifying
version.org.jacoco..org.jacoco.agent=0.8.5
version.org.jacoco..org.jacoco.core=0.8.5
(org.jacoco.core is added as a dependency from another configuration), why not specify
version.org.jacoco=0.8.5
and have this satisfy both artifacts. This however does not work, the next call to refreshVersions will remove version.org.jacoco=0.8.5 and replace it with the "more specific" version.org.jacoco..org.jacoco.core=0.8.5.
refreshVersions doesn't support specifying versions this way yet.
Regarding the version key, it uses the full maven coordinates unless a matching rule is specified in the bootstrap, or bundled in the plugin itself, that's normal behavior.
this is sort of implemented now with versionFor
https://jmfayard.github.io/refreshVersions/add-dependencies/#get-the-version-from-anywhere
That is absolutely now supported since 0.50.0+:
Calling versionFor("org.jacoco..org.jacoco.agent:_") will get you the version AND enable updates lookup.