Evandro Pomatti
Evandro Pomatti

Reputation: 15094

How to change Gradle version in Eclipse using Buildship?

I am running Eclipse Luna SR2 with Buildship 1.0.1.

The Gradle projects I create using the wizard are building with Gradle 2.5-rc-2, but I would like to use 2.6 which is the latest version.

How can I do it?

Setting the task had no effect:

apply plugin: 'java'

repositories {
    jcenter()
}

dependencies {
    testCompile 'junit:junit:4.12'
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.6'
}

Solution: For some reason it is only working if I restart Eclipse after setting the version as Makoto suggested.

Upvotes: 6

Views: 17108

Answers (3)

SteadyBigman
SteadyBigman

Reputation: 11

I had the same issue with different versions. The solution is to add the following task to your build file, then run gradle wrapper task in the project root folder:

task wrapper(type: Wrapper) {
  gradleVersion = '2.6'
}

The reason the wrong version of wrapper was used for the build is that there was no wrapper created for the version I wanted to use.

Upvotes: 0

user2298337
user2298337

Reputation:

You can create a new Run Configuration of type Gradle Project running the task wrapper. Running this run configuration should update the wrapper version without the need to restart eclipse.

Upvotes: 0

Makoto
Makoto

Reputation: 106390

If you want to use the wrapper, it's a simple matter of setting the gradleVersion property:

task wrapper(type: Wrapper) {
    gradleVersion = '2.6'
}

Upvotes: 7

Related Questions