Getting gradle version from build.gradle or settings.gradle


(DC) #1

Is there a cleaner way to get the gradle version then the code below?

println GradleConnector.newConnector().forProjectDirectory(rootDir).connect().getModel(BuildEnvironment.class).getGradle().getGradleVersion()`

Idealy i would to get the version from the settings.gradle file.

Thanks


(Stefan Oehme) #2

If you’re in a build script, just use gradle.gradleVersion.


(DC) #3

perfect. that works in build.gradle and settings.gradle Thank you.