I have a gradle project in Eclipse that was first configured not to use the gradle wrapper. So, in the command line, I run:
to generate the required wrapper files. And the files were generated:
I thought that just doing this when I used the Gradle Tasks view to run tasks the gradle wrapper would be used, but I was wrong. For example, the below image shows the output when I run the build task.
As you can see, it says:
Gradle Distribution: Local instalation at C:\gradle-6.6.1
clearly showing that the wrapper wasn’t used, but the local distribution in my machine instead.
If the wrapper was being used I think I would see something like this:
Gradle Distribution: Gradle wrapper from target build
So, how do I configure my Eclipse project to use the wrapper when running tasks in the IDE?
Right click on the project => Properties => Gradle. Is it set to use the wrapper (either directly or by inheriting from the workspace settings)?
Yes, it is. I also checked this before.
I was able to solve the problem doing this:
- Deleted the project from Eclipse
- Added the gradle wrapper manually from the command line (gradle wrapper)
- Imported the project in Eclipse configured to use the gradle wrapper
After those steps Buildship was still using the gradle local installation. So, I did this: repeated steps 1 and 2 above again, but before doing step 3, I manually deleted everything from the Eclipse workspace folder that was still referencing the deleted project.
So, when I did step 3 again, it worked: Buildship started using the gradle wrapper.
Sad that I had to delete a lot of junk that was still referencing the old project to make this work. Eclipse should have done this automatically when I deleted the project.