Gradle says I'm running one version of Groovy when I'm actually running another

Hi, I’m new to the forums and to Gradle.

I’m running Groovy 2.2.1 and Gradle 1.10 on Ubuntu 13.04.

I uninstalled my old (1.8.6) version of Groovy yesterday through Ubuntu Software Center, which is where I got it in the first place.

Then I installed Groovy 2.2.1 and Gradle via gvm.

groovy -version says that I’m running Groovy 2.2.1.

gradle --version says this:

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.9.2 compiled on July 8 2013 Ivy:

2.2.0 JVM:

1.7.0_25 (Oracle Corporation 23.7-b01) OS:

Linux 3.8.0-29-generic i386

I’m not sure what to make of this. Where is Gradle looking for the Groovy version information?

Could this cause compile issues? I’ve done a couple of builds; classes and jars get built as expected. I just ran into a weird exception on one build, though, and I want to rule out any potential environmental issues.

Thanks.

The Gradle distribution bundles its own version of Groovy. What you see there is the version of Groovy under GRADLE_HOME/lib. It’s not the version you installed on your system. At runtime Gradle always uses the bundled version of Groovy for the build script code.

Good to know - thanks.

I just came over this. I have these lines in settings.gradle, just to get a grip on my environment:

println "** Java Version:
 "+System.getProperty("java.version")
println "** Groovy Version: "+GroovySystem.getVersion()
println "** Gradle Version: "+gradle.gradleVersion

And then I wondered why use this old version of Groovy when 2.2.0 is out. Can it be changed?

No, it cannot be changed. The reason why Gradle hasn’t yet upgraded to a newer Groovy version is that Groovy isn’t backwards-compatible between major versions. As a result, upgrading would break a fair amount of existing Gradle builds (i.e. it would break Gradle’s backwards compatibility). Of course, you can choose any Groovy version you like when compiling Groovy code, just not for Gradle build scripts and Gradle plugins implemented in Groovy. And for the latter, it usually doesn’t matter all that much.