Extending JavaCompile in gradle2.5 [solved]

Hi, for my gradle plugin, I was using a custom subclass of org.gradle.api.tasks.compile.JavaCompile to generate and compile sources in the build folder.

For this I used an overwritten AbstractTask.executeWithoutThrowingTaskFailure() method that changes some members before invoking super.executeWithoutThrowingTaskFailure()

I notice that in gradle2.5 AbstractTask.executeWithoutThrowingTaskFailure() has been removed, so my plugin does not compile using gradle 2.5. Is there a better way I can programatically add a JavaCompile Task to a project with custom settings, ideally compatible with gradle1.12 to 2.5?

I try this, but the task never gets executed:

public class MyCompileTask extends JavaCompile

public void apply() {

EDIT: Proposed solution does not work.

EDIT: making the changes in the Constructor of my subclass also does not work.

EDIT: Invoking doFirst({…}) in the constructor does also not work.

EDIT: I ended up using a custom task for the file generation only, and a clean JavaCompile task for the compilation. More tasks floating around, but less hacking…