[GRADLE-3537] Classloading issue for Enum as task input property Created: 26/Aug/16 Updated: 12/Sep/16 Resolved: 12/Sep/16 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 2.11, 2.12, 2.13, 2.14.1, 3.0 |
Fix Version/s: | 3.1-rc-1 |
Type: | Bug | ||
Reporter: | Benjamin Muschko | Assignee: | Lari Hotari |
Resolution: | Fixed | Votes: | 0 |
Description |
An Enum is defined as class in buildSrc. For example: package org.gradle; public enum MessageType { HELLO_WORLD } The given enum is used as input property for an ad-hoc task: import org.gradle.MessageType task createFile { ext.messageType = MessageType.HELLO_WORLD ext.outputFile = file('output.txt') inputs.property('messageType', messageType) outputs.file(outputFile) doLast { outputFile << messageType } } Executing the task leads to the following exception: :buildSrc:compileJava UP-TO-DATE :buildSrc:compileGroovy UP-TO-DATE :buildSrc:processResources UP-TO-DATE :buildSrc:classes UP-TO-DATE :buildSrc:jar UP-TO-DATE :buildSrc:assemble UP-TO-DATE :buildSrc:compileTestJava UP-TO-DATE :buildSrc:compileTestGroovy UP-TO-DATE :buildSrc:processTestResources UP-TO-DATE :buildSrc:testClasses UP-TO-DATE :buildSrc:test UP-TO-DATE :buildSrc:check UP-TO-DATE :buildSrc:build UP-TO-DATE :createFile BUILD FAILED Total time: 1.053 secs ----- Error: FAILURE: Build failed with an exception. * What went wrong: Could not read entry ':createFile' from cache taskArtifacts.bin (/home/tcagent2/agent/work/e94d7a966081366e/subprojects/core/build/tmp/test files/TaskInputPropertiesIntegrationTest/can_use_Enum_from_b..._property/4iro8/.gradle/3.1-20160826162728+0000/taskArtifacts/taskArtifacts.bin). > org.gradle.MessageType * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.UncheckedIOException: Could not read entry ':createFile' from cache taskArtifacts.bin (/home/tcagent2/agent/work/e94d7a966081366e/subprojects/core/build/tmp/test files/TaskInputPropertiesIntegrationTest/can_use_Enum_from_b..._property/4iro8/.gradle/3.1-20160826162728+0000/taskArtifacts/taskArtifacts.bin). at org.gradle.cache.internal.btree.BTreePersistentIndexedCache.get(BTreePersistentIndexedCache.java:128) at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache$1.create(DefaultMultiProcessSafePersistentIndexedCache.java:37) at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.readFile(DefaultFileLockManager.java:159) at org.gradle.cache.internal.DefaultCacheAccess$UnitOfWorkFileAccess.readFile(DefaultCacheAccess.java:396) at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache.get(DefaultMultiProcessSafePersistentIndexedCache.java:35) at org.gradle.api.internal.changedetection.state.InMemoryTaskArtifactCache$1.get(InMemoryTaskArtifactCache.java:95) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$2.create(CacheBackedTaskHistoryRepository.java:128) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$2.create(CacheBackedTaskHistoryRepository.java:123) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:102) at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:183) at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:56) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.loadPreviousExecutions(CacheBackedTaskHistoryRepository.java:123) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.getHistory(CacheBackedTaskHistoryRepository.java:57) at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository.getStateFor(DefaultTaskArtifactStateRepository.java:66) at org.gradle.api.internal.changedetection.changes.ShortCircuitTaskArtifactStateRepository.getStateFor(ShortCircuitTaskArtifactStateRepository.java:47) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:49) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:74) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:55) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:186) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:183) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:33) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:112) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:106) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:92) at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:85) at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:59) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.execute(HintGCAfterBuild.java:44) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:293) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) Caused by: java.lang.ClassNotFoundException: org.gradle.MessageType at org.gradle.internal.io.ClassLoaderObjectInputStream.resolveClass(ClassLoaderObjectInputStream.java:40) at org.gradle.internal.serialize.DefaultSerializer.read(DefaultSerializer.java:45) at org.gradle.internal.serialize.MapSerializer.read(MapSerializer.java:37) at org.gradle.api.internal.changedetection.state.InputPropertiesSerializer.read(InputPropertiesSerializer.java:35) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$LazyTaskExecution$LazyTaskExecutionSerializer.read(CacheBackedTaskHistoryRepository.java:329) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$TaskExecutionListSerializer.read(CacheBackedTaskHistoryRepository.java:186) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$TaskExecutionListSerializer.read(CacheBackedTaskHistoryRepository.java:172) at org.gradle.cache.internal.btree.BTreePersistentIndexedCache$DataBlock.getValue(BTreePersistentIndexedCache.java:661) at org.gradle.cache.internal.btree.BTreePersistentIndexedCache.get(BTreePersistentIndexedCache.java:120) ... 81 more The following test case reproduces the issue on some of the coverage builds: TaskInputPropertiesIntegrationTest.can use Enum from buildSrc as input property. |