[GRADLE-3207] Task extending 'jar' compiled with Gradle 2.0 fails to run in Gradle 2.2 Created: 05/Dec/14 Updated: 27/Jan/15 Resolved: 27/Jan/15 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 2.3-rc-1 |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Known Issue Of: |
Description |
In Gradle 2.2, the Jar task was ported from Groovy to Java. This causes issues with some tasks that subclass Jar: if they are compiled with a version of Gradle < 2.2 they are unable to execute in Gradle 2.2. To workaround this problem: ------------------------------------------------------------------- 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 { @TaskAction } Results in the following exception: [1]https://gist.github.com/johnrengelman... 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: [] |
Comments |
Comment by Gradle Forums [ 05/Dec/14 ] |
Can you try two things please: 1. Run with `-S` and provide the stacktrace (need to see the Groovy internals) If the result of 2.2 is different, that means we've introduced a binary incompatibility in our class decoration goop. |
Comment by Gradle Forums [ 05/Dec/14 ] |
Hey Luke, 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 |
Comment by Gradle Forums [ 05/Dec/14 ] |
So that is definitely the trace when running with `-S` and not `-s`? |
Comment by Gradle Forums [ 05/Dec/14 ] |
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 |
Comment by Gradle Forums [ 05/Dec/14 ] |
Another workaround would be to implement the ShadowJar class in Java instead of Groovy and rebuild with a 1.x version of Gradle. |
Comment by Gradle Forums [ 05/Dec/14 ] |
Oh that's a thought. I'll give that a shot today. |
Comment by Gradle Forums [ 05/Dec/14 ] |
Hi Luke, Cheers |
Comment by Gradle Forums [ 05/Dec/14 ] |
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? |
Comment by Gradle Forums [ 05/Dec/14 ] |
Luke, |
Comment by Gradle Forums [ 05/Dec/14 ] |
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. |