Determine Gradle version programmatically from Gradle plugin
2 answers
It just turned out that one can get it using
-
getProject().getGradle().getGradleVersion()
Javadoc and DSL link for the core Gradle type that contains the version. As per the javadoc, getVersion will never return null.
or
-
Plugin.class.getPackage().getImplementationVersion()
It is simple groovy / java class based and depends on the classloader and the provided manifest.
+5
source to share