How to update gradle wrapper version in buildship


(Steve Cohen) #1

The standard answer seems to be to use the wrapper task. Okay. But where do you specify the version of wrapper you want to use? If I choose Run As -> Run Configuration, Eclipse lets me specify arguments for the task, but
--gradle-version=3.3 is rejected as an argument. On the command line, it is possible to say

          `gradle wrapper --gradle-version=3.3`

which does the job.

How to achieve the same thing in Eclipse/Buildship?


(briemla) #2

It is possible to specify the gradle version in the build file, as mentioned in the userguide. Specifying a wrapper task removes in my case the wrapper task from the Gradle Tasks View, but it is also possible to specify just the wrapper version using the property:

wrapper.gradleVersion = '4.0'

Starting the wrapper from the Gradle Tasks View inside eclipse will download the wrapper matching the specified version. Ensure that you refresh the tasks view after changes in your build file, otherwise you changes might not be used.

I hope this will help you.


(Stefan Oehme) #3

I think there’s some confusion here. The wrapper task is there by default, you just need to configure it. If you create a new one with the same name, you are replacing the existing one, which leads to it disappearing from the task view because your new one probably doesn’t specify a group.

When you write wrapper.gradleVersion, all you are doing is configuring the existing wrapper task.


(Steve Cohen) #4

Thanks, guys, this is what I was looking for months ago!


(briemla) #5

@st_oehme Thanks for clarifying this. I think it would be nice to mention this in the gradle userguide, because UI Tools, like buildship, rely on the group property. Overriding the wrapper task without setting the group property will lower the user experience of gradle in the UI.