Reputation: 2552
It seems like Grails 3 ships with Gradle 2.3 and I need to downgrade it to 2.2. Is there a way to tell grails to run gradle 2.2 instead of 2.3?
Upvotes: 0
Views: 3214
Reputation: 1186
To set the gradle version that grails uses:
1) First, install your gradle version in a specific location. As I type this, gradle 2.9 goes with grails 3.1.4, but here are instructions for a gradle 2.2 installation, as you request.
a) wget -c http://services.gradle.org/distributions/gradle-2.2-all.zip
b) unzip gradle-2.2-all.zip
c) sudo mv gradle-2.2 /usr/local/gradle-2.2
d) set your GRADLE_HOME environment variable and add GRADLE_HOME/bin to the path. in your $HOME/.bash_profile or in a /etc/profile.d/gradle.sh file:
i) GRADLE_HOME=/usr/local/gradle-2.2
ii) export GRADLE_HOME=$GRADLE_HOME
iii) PATH=$PATH:$GRADLE_HOME/bin
iv) export PATH=$PATH
v) source $HOME/.bash_profile
vi) gradle -v should say gradle 2.2
2) in $HOME/.gradle/gradle.properties, you can set whether or not you want to use the gradle daemon by including a line that says:
org.gradle.daemon=true (gradle will use the daemon when appropriate)
or
org.gradle.daemon=false (it won't use the daemon)
3) in your project, myproj, which I assume will be in $HOME/projects/myproj
$HOME/projects/myproj/gradle.properties should look like:
grailsVersion=3.1.4 (or whatever version you are using)
gradleWrapperVersion=2.2 (again, answering your question)
4) in $HOME/projects/myproj/gradle/wrapper/gradle-wrapper.properties, the last line should say:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
in newer versions, this says gradle-2.9-bin.zip (it's what you originally wget'ed)
5) finally, 'cd $HOME/projects/myproj' and './gradlew bootRun' to run your project. or, 'gradle bootRun'. grails likes to use the wrapper via the ./gradlew command. Use './gradlew assemble' to build your .war. if you think you are not running the version you think you should be, use './gradlew clean --refresh-dependencies'.
good luck!
Upvotes: 1
Reputation: 264
Have you looked at your gradle.properties file? Mine looks like this:
grailsVersion=3.0.11
gradleWrapperVersion=2.3
grails.groovyVersion=2.4.5
Not sure about downgrades. 2.3 has worked fine for me so far.
Upvotes: 0