Using extension as input object in a task


(Markus Oley) #1

Hi,

I have a certain task, which can be configured by a extension.

I want to add this extension to the uptodatecheck, so I added

a field

@Input

FooDsl foo

But than I get an error

Caused by: java.io.NotSerializableException: org.gradle.api.internal.AsmBackedClassGenerator$MixInExtensibleDynamicObject

at org.gradle.messaging.serialize.DefaultSerializer.write(DefaultSerializer.java:53)

at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$LazyTaskExecution$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:276)

at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:156)

at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:136)

Is it possible to use extensions as input object?

Cheers Markus


#2

I don’t think you can use the extension itself, but you could apply values from the extension to the task, and declare these as inputs to the task. The problem is likely that an Extension object is a dynamic object in Gradle, and so cannot be simply serialised.


(Markus Oley) #3

OK, thank you for your answer