I have run into an InvalidClassException while developing my plugin that uses the extension mechanism. The problem is that I have set the extension as an input to a task, which seems right as if something in the extension changes, the task is not up to date. However, while developing the plugin, I need to change the extension, adding fields and such, and this changes the serialVersionUID, and hence it cannot be deserialized for the up to date check.
The catch is that the up to date checker fails with an InvalidClassException, stopping the whole build every time I modify my plugin extension code. The only option I have been able to find to get past this is to do a “gradle -C rebuild”, but that seems overkill when all I really want is to zap this single item. So, three questions:
Is there a way to tell gradle to zap a single item from the cache?
would it not be better for gradle, on encountering a serialization error, to go ahead and remove the offending item? Even if you want to stop the build, at least rerunning gradle a second time will avoid the error.
Is there a better way to do plugin development with extensions to avoid this issue?
Lastly, I filed this issue back in March as
http://issues.gradle.org/browse/GRADLE-2084 with a patch to have the up to date checker just return null when encountering one of these, effectively saying the resource is out of date. Can someone have a look as see if that is a reasonable solution?