Gradle – Adding dependecy to task eclipse fails


Vista-eclipse (Photo credit: Wikipedia)

Today I toyed a little bit around with gradle and tried to add an additional path to for separate generated files from my own code.

This works very well via srcDirs += ‘src/main/generated’.

But after I cleaned up my project folder (removing IDE specific files and the generated classes) and using the eclipse task , to generate the files required by eclipse, I faced the problem that eclipse shows classpath errors. This is because gradle recognizes that it has to mark multiple folders as source folders for eclipse, but didn’t execute the generation task.

So I thought about this issue and attempted to solve it via

But gradle tolds me

Consulting the documentation didn’t show any new information about that (and following it, I’ve done everything right).

But Google brought breaking changesin Gradle 1.0.M4 to light.  From now on adding a dependency to the idea and eclipse tasks is only possible via

With this information I’m now able to generate also the required files and paths when using the eclipse or idea task of gradle.

5 Kudos

Leave a Reply

Your email address will not be published. Required fields are marked *