I have implemented the following custom task which uses a nested enum: https://gist.github.com/abeggchr/b338d827312a67526cac
When executing an instance of this task (for the second time), the following exception is thrown:
org.gradle.api.UncheckedIOException: Could not read entry ':problem' from cache taskArtifacts.bin (/home/sam/Downloads/UncheckedIOException/.gradle/2.0/taskArtifacts/taskArtifacts.bin).
at org.gradle.cache.internal.btree.BTreePersistentIndexedCache.get(BTreePersistentIndexedCache.java:129)
at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache$1.create(DefaultMultiProcessSafePersistentIndexedCache.java:37)
...
Caused by: java.lang.ClassNotFoundException: com.mine.tasks.TaskWithEnum$Language
at org.gradle.internal.io.ClassLoaderObjectInputStream.resolveClass(ClassLoaderObjectInputStream.java:40)
at org.gradle.messaging.serialize.DefaultSerializer.read(DefaultSerializer.java:45)
at org.gradle.messaging.serialize.MapSerializer.read(MapSerializer.java:37)
at org.gradle.api.internal.changedetection.state.InputPropertiesSerializer.read(InputPropertiesSerializer.java:35)
...
Deleting the “.gradle” directory only helps for the first build after the deletion. The second build will fail again.
Refactoring the Enum to a separate file (i.e. com.mine.tasks.Language) does not help either: The same UncheckedIOException caused by ClassNotFoundException is thrown.