Cannot call inherited protected methods from tasks in Gradle 2.2

Defining a task class that extends a built in task type in Gradle 2.2 throws an exception when trying to call a protected method from the super class.

class ShadowJar extends Jar {


protected void copy() {


println ‘copy done’



Results in the following exception:

Caused by: groovy.lang.MissingMethodException: No signature of method:

com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar_Decorated.copy() is applicable for argument types: () values: []

Possible solutions: any(), any(groovy.lang.Closure), notify(), wait(), grep()

Can you try two things please:

  1. Run with ‘-S’ and provide the stacktrace (need to see the Groovy internals) 2. Recompile the plugin with 2.2, then try your test case again

If the result of 2.2 is different, that means we’ve introduced a binary incompatibility in our class decoration goop.

Hey Luke,

The full strack trace is in the GIST link that I included above. Building the plugin with Gradle 2.2 does fix the problem and that build of the plugin seems to run in Gradle 2.1 and 2.0, but it no longer runs in Gradle 1.x because of the change in Groovy versions.

That’s something I can work around by documenting that you need to include the ‘groovy-backports-compat23’ library when using with Gradle 1.x

So that is definitely the trace when running with ‘-S’ and not ‘-s’?

I guess not. I had compared it earlier and thought they were the same, but on close look they are a bit different.

I updated the GIST to have the full output using ‘-S’ and also added a sample ‘build.gradle’ file

Another workaround would be to implement the ShadowJar class in Java instead of Groovy and rebuild with a 1.x version of Gradle.

Oh that’s a thought. I’ll give that a shot today.

Hi Luke, we have exactly the same problem here. Due to the fact that we implemented all our plugins in Groovy it would be a real pain for us to rewrite the tasks in Java. So at this time, moving to a higher version of gradle than 2.1 is a showstopper for us.

Cheers Thorsten


To fix these, you’d just need to recompile your subclasses with Gradle 2.2. They will then work.

Is this still a blocker for you?

Luke, this is a good hint. Haven’t tried it yet. I will tell you on Monday if that’ll work.

It is working if I compile it with gradle 2.2 though we had a “chicken-and-egg” problem because we build our own plugins with our own plugin. But for us the case is closed. Thanks Luke!