My source task extension contains a @Input List<String> args
which Gradle 2.13 claims is not serializable:
Unable to store task input properties. Property ‘args’ with value ‘[a, b]’ cannot be serialized.
I have a found a workaround by looking at an older post:
class MyTask extends SourceTask {
List<String> args
@Input
List<String> getArgsWorkaround() {
args.collect { it.toString() }
}
}
Is this a bug in Gradle?
Code demonstrating the problem here.
I cannot reproduce the serialisation problem with Gradle 2.13, so not sure what is happening on your side.
I would however like to mention that idiomatic-wise it is usually better to have annotations on getters rather than fields. See slides 9-14 of http://www.slideshare.net/ysb33r/idiomatic-ggradle-plugin-writing.
(This is also described in more detail in the Idiomatic Gradle book).
Yes, I remember seeing that in the book. In my case, I can reproduce it every time (using Gradle 2.13 also). If I write is as three methods as you explain, the problem goes away.