I saw an (old) post on the Gradle community that s...
# community-support
d
I saw an (old) post on the Gradle community that stated plugin version resolution functioned with 'latest.release' or the other notations to always provide latest like '1.+', etc. since Gradle 7.x I am seeing this is not working properly in my build environment with Gradle v9.1.0, but I am unable to see what version of a plugin is actually resolved, with gradlew --info, I only see '1.+' was resolved, but not the specific version that was selected. gradlew dependencies doesn't show the plugins dependency tree -- is there a command that will show the specific plugin versions selected for a build?
s
I think you’re looking for
./gradlew buildEnvironment
d
yes I am -- thank you much!
using the latest version for the plugin works '1.2.0', but when I use 'latest.release' or '1.+', it returns 1.1.0 in the maven repository, in the plugin folder, (and the jar publish folder) it lists 1.2.0 in the maven-metadata as latest1.2.0/latest release1.2.0/release how/why would it then resolve to 1.1.0?
running ./gradlew buildEnvironment --debug
Copy code
Attempting to resolve version for com.<myPlugin>:com.<myPlugin>.gradle.plugin:latest.release using repositories [gradleplugins, maven]
Using cached module metadata for module 'com.<myPlugin>:com.<myPlugin>.gradle.plugin:1.1.0' in 'maven'
v
is it the same latest version in Plugin Portal, and Maven ? Maybe when you're using latest it bases itself on Plugin Portal, and when using 1.2.0 it may not find it in Plugin Portal and searchs for it in Central ?
d
these are in my company's maven repository, not in an external portal.. though it should still resolve?
v
the debug seems to say that
using repositories [gradleplugins, maven]
so my supposition was that the status may not be the same in these repositories
s
sometimes maven-metadata.xml doesn’t get properly updated in these company repository mirrors
d
also says its finding it in the maven repo, which is where we currently publish plugins (odd, but true), and the maven metadata says 1.2.0 is latest
s
try running Gradle with --refresh-dependencies
d
oh, could it be something local caching the previous version? i'll check that out
now it resolved -- amazing
v
yeah version caching can be a fickle beast
d
so.... how do i prevent that from happening on other dev's machines? is there a simple solution?
s
depend on the exact version
or use dependency locking
d
we're shortly moving to a version catalog, haven't done the work yet, but will that allow specifying plugin versions as well?
v
usually depending on a non-exact version is a bad idea
and yes for the version catalog
s
of course but that’s unrelated, you can just use ‘1.2.0’ instead of ‘latest.release’
(and you could specify latest.release in the version catalog as well so that’s why I say it’s unrelated)
v
(using non-exact versions can lead in the best case to non-reproducible builds and in the worst to supply-chain attacks)
so unless you have a very good reason to use a non-exact version I'd advise against it
d
super. i totally get not depending on non-exact versions for production dependencies, but this plugin is only quality tools not anything included in a deployable release
👍 1
s
that’s until an attacker hijacks it and puts some extra code in there…
d
trying to minimize the amount of time devs are bumping versions for non-included objects that are common across all of our builds
fair point. maybe i'll just use the specific version and it will be one more 'updateable' version until we get to the version catalog support thanks for your help -- both of you -- helped alot
👌 2