defaultTasks not run


(tulsoba) #1

I am trying to enable the some of the tasks from the eclipse plugin to my default tasks:

apply plugin: 'eclipse'
...
defaultTasks 'cleanEclipseClasspath', 'eclipseClasspath'

but when I run gradle build the above tasks are not run. Is it only possible to use defaultTasks for tasks defined in the build.gradle file?


(Peter Niederwieser) #2

Default tasks only take effect when you run Gradle without explicitly specifying any tasks.


(cmsering) #3

So Peter, how do you force a task to execute every time a script is run, no matter what tasks are specified?


(Peter Niederwieser) #4

You could declare a dependency from all other tasks on that task (generically of course), or fiddle with ‘gradle.startParameter.taskNames’.


(cmsering) #5

Just what I needed, thanks Peter.