What Gradle tasks does a Buildship import run?

My rough (but probably not quite right) impression is that when I import a Gradle project tree using Buildship, mostly it’s just the configuration phase of the Gradle build that gets run and no tasks get executed. In any case, that’s been my experience. However, as a result of some changes I haven’t narrowed down to, in some cases the import causes a bunch of tasks to be executed.

I turned on –info in the Gradle Eclipse preferences. In the happy case, I see this in my Console view:

All projects evaluated.
Selected primary task 'nothing' from project :
Tasks to be executed: [task ':nothing']
Tasks that were excluded: []

and no “surprising” tasks get executed.

In the unhappy case, the “Tasks to be executed” line includes a bunch of tasks in addition the :nothing task. (I’m seeing this case in the context of a branch where a co-worker made a ton of changes so it’s hard for me to narrow down which change caused this change in behavior)

Can someone explain to me how Buildship determines which tasks should be executed as part of an import?



The executed tasks are configured in the eclipse plugin DSL:

plugins {
  id 'eclipse'

eclipse {
  synchronizationTasks​ 'myTask'

By default, the synchronization task list is empty, in which case Buildship schedules a synthetic empty task called nothing.

None of our projects specify the synchronizationTasks feature. In fact we explicitly use the eclipse plugin DSL in only one project and there we use it only to manipulate that project’s classpath. From looking at the code you linked to I see there’s some logic related to the autoBuildTasks feature but we don’t use that either. Can you think of any other thing that’d make the synchronization task list non-empty? Or suggestions on how to debug this behavior further? Thanks.

I don’t have further suggestions here. If you can provide a minimal reproducer project then I’ll be happy to take a look.