Automatically perform certain actions like run xjc while importing Gradle project

I would like to perform some tasks before a multi-module gradle project is imported.

Here is an example scenario with following project setup:

parent-project
      my-service
      my-schema
           src/main/resources/schema.xsd

my-service depends on my-schema JAXB classes for compilation.
The JAXB classes need to be compiled from JAXB Sources.
JAXB sources need to be generated from the schema.xsd by calling xjc.

Trying to import parent-project along with the modules leaves the whole thing in “red” in Eclipse before manually doing a build (xjc) on the command line.

This later part is what I want to avoid. Any pointers ?

Another situation is when someone pulls stuff from Git I might want to run a particular task.

Here is one scenario I asked on stackoverflow

The issue seems to be Eclipse-related work than anything else, so I am dropping the necessray dumb question in here: Have you tried this with Buildship yet?

Yes. I tried importing that freshly cloned project using clean Eclipse Mars with Gradle Buildship (without no other Gradle related plugin).

Simple question:

Can buildship provide some task that we can extend so that custom actions can be performed during project import ?

Currently there is no Buildship support for executing tasks upon import.