Is there a sane way to get the version of an (unap...
# community-support
s
Is there a sane way to get the version of an (unapplied) settings plugin in a conventional plugin inside
buildSrc
?
v
If the plugin somehow provides its version. From Gradle afair you cannot even get the version of a plugin if it is applied.
👆 1
s
From Gradle afair you cannot even get the version of a plugin if it is applied.
Oh, I though this changed at some point when the plugin manager API was introduced...
v
Not that I remember, but that doesn't mean too much 😄
t
The question can be more-or-less rephrased as: is there a sane way to get the version of a dependency JAR in the classpath in a conventional plugin inside
buildSrc
? (actually it'll be the context classloader rather than "the classpath", but you get the idea)
l
There is a getVersion() for dependencies but there is no getVersion() method for plugins (even an applied one). TLDR: no.
s
On the other hand, https://github.com/gradle/github-dependency-graph-gradle-plugin is somehow able to determine the version of plugins. I need to investigate this further.
v
I don't think it is.
It can maybe get the contents of a given buildscript classpath.
But when then you don't know which plugin version might get applied, as an ancestor classloader could provide a different version which would win.