Copy task fails with internal error caused by file locking


(Scott Palmer) #1

This is with 1.0-rc-3 The tasks in question look like this:

task prepareMyCopy(dependsOn: [generateFiles]) << {
 println "Copying from ${project.srcGeneratedDir}/java to ${project.pluginInstallDir}"
 println "Copying from ${project.srcGeneratedDir} excluding java/** to ${project.pluginInstallDir}/dev"
 tasks['myCopy'].into
project.pluginInstallDir
 tasks['myCopy'].from( "${project.srcGeneratedDir}/java" ) { include "*.jar" }
 tasks['myCopy'].from( "${project.srcGeneratedDir}" )
{
   into { "dev" }
  exclude "java/**"
 }
 tasks['myCopy'].from( "$docsGeneratedDir" )
{ into { "$docsGeneratedInstallDir" } }
}
task myCopy(type: Copy, dependsOn: prepareMyCopy)

The output is: :prepareMyCopy Copying from src-generated/java to C:\Users\the\correct\path Copying from src-generated excluding java/** to C:\Users\the\correct\path/dev

:myCopy

FAILURE: Build aborted because of an internal error.

  • What went wrong: Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.

  • Try: Run with --debug option to get additional debug info.

  • Exception is: org.gradle.api.UncheckedIOException: java.io.IOException: The process cannot access the file because another process has locked a por tion of the file

at org.gradle.util.hash.HashUtil.createHash(HashUtil.java:56)

at org.gradle.util.hash.HashUtil.createHash(HashUtil.java:34)

at org.gradle.api.internal.changedetection.DefaultHasher.hash(DefaultHasher.java:24)

at org.gradle.api.internal.changedetection.CachingHasher.hash(CachingHasher.java:42)

at org.gradle.api.internal.changedetection.DefaultFileSnapshotter.snapshot(DefaultFileSnapshotter.java:44)

at org.gradle.api.internal.changedetection.InputFilesChangedUpToDateRule.create(InputFilesChangedUpToDateRule.java:35)

at org.gradle.api.internal.changedetection.CompositeUpToDateRule.create(CompositeUpToDateRule.java:35)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.calcCurrentState(DefaultTaskA rtifactStateRepository.java:80)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.isUpToDate(DefaultTaskArtifac tStateRepository.java:88)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArt ifactStateRepository.java:128)

at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$ShortCircuitArtifactState.isUpToDate(Short CircuitTaskArtifactStateRepository.java:77)

at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskA rtifactStateRepository.java:37)

at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)

at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)

at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)

at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)

at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)

at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)

at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)

at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)

at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)

at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)

at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:3 1)

at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)

at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.j ava:79)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java :29)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)

at org.gradle.launcher.daemon.protocol.Build.run(Build.java:68)

at org.gradle.launcher.daemon.protocol.Build.run(Build.java:64)

at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:45)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:28)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:116)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:114)

at org.gradle.util.Swapper.swap(Swapper.java:38)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:114)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:61)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.HandleClientDisconnectBeforeSendingCommand.execute(HandleClientDisconnectBeforeSend ingCommand.java:21)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.StopConnectionAfterExecution.execute(StopConnectionAfterExecution.java:27)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:55)

at org.gradle.launcher.daemon.server.Daemon$1$1.run(Daemon.java:123)

at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

at java.lang.Thread.run(Thread.java:722) Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file

at java.io.FileInputStream.readBytes(Native Method)

at java.io.FileInputStream.read(FileInputStream.java:220)

at org.gradle.util.hash.HashUtil.createHash(HashUtil.java:46)

… 83 more

BUILD FAILED

Total time: 2.513 secs


(Peter Niederwieser) #2

Not sure if it is related to the problem, but ‘prepareMyCopy’ looks very wrong. Tasks should be configured in the configuration phase, not in the execution phase. Try this:

task myCopy {
    into pluginInstallDir
    from("$srcGeneratedDir/java") {
       include "*.jar"
     }
    from(srcGeneratedDir) {
       into "dev"
      exclude "java/**"
    }
    from(docsGeneratedDir) {
       into docsGeneratedInstallDir
     }
 }

(Scott Palmer) #3

The fact is that I don’t have the information for the copy task until it’s dependencies run. The name of the destination directory is not known until a file is read and parsed as part of the build.

I could call copy within the task I suppose, but my understanding was that I would then lose Gradle’s automatic “up-to-date” task skipping that I was hoping to leverage. For a simple file copy perhaps it doesn’t matter, but I thought this was a valid pattern for Gradle.

Is there some sort of “Gradle Best Practices” document somewhere that might document the patterns that I’m expected to use? The docs I find basically show a zillion ways to do things and I’m left wondering if there is a “right way”.


(Peter Niederwieser) #4

Does the file parsing have to be a task, or can it be done at configuration time? Anyway, you can defer evaluation of the paths passed to ‘from’ and ‘into’ by wrapping them with a closure. For example: ‘into { pluginInstallDir }’

A good way to get a solid understanding of Gradle is to study the user guide and the samples in the full Gradle distribution.


(Scott Palmer) #5

I’ve addressed the issues with the configuration, but I still get the same error.


(Peter Niederwieser) #6

Maybe you have multiple daemons running. I suggest to check which process is locking the file.


(Scott Palmer) #7

I rearranged some things and now I’m getting another error:

:copyPluginXml

FAILURE: Build aborted because of an internal error.

  • What went wrong: Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.

  • Try: Run with --debug option to get additional debug info.

  • Exception is: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean

at $Proxy31.isSatisfiedBy(Unknown Source)

at org.gradle.api.specs.OrSpec.isSatisfiedBy(OrSpec.java:39)

at org.gradle.api.specs.AndSpec.isSatisfiedBy(AndSpec.java:41)

at org.gradle.api.specs.AndSpec.isSatisfiedBy(AndSpec.java:41)

at org.gradle.api.internal.file.collections.DirectoryFileTree.isAllowed(DirectoryFileTree.java:172)

at org.gradle.api.internal.file.collections.DirectoryFileTree.walkDir(DirectoryFileTree.java:149)

at org.gradle.api.internal.file.collections.DirectoryFileTree.visit(DirectoryFileTree.java:119)

at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(FileTreeAdapter.java:96)

at org.gradle.api.internal.file.AbstractFileTree.isEmpty(AbstractFileTree.java:48)

at org.gradle.api.internal.file.CompositeFileCollection.isEmpty(CompositeFileCollection.java:57)

at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:36)


(Peter Niederwieser) #8

Code, please.


(Scott Palmer) #9

These are the tasks involved… I moved the file parsing to a function that runs during config and sets up the project.ext.* variables. All of the files and folders print correctly for the initPluginInstallDir task… then I get the above error.

task initPluginInstallDir() << {
 if( project.buildPlatformEnabled ) {
  println( "Plugin Install Dir= "+project.pluginInstallDir);
  if( !pluginInstallDir )
   println "***** ProjectDir= $project.projectDir "
  project.pluginInstallDir.mkdirs();
 }
 println "copying from ${project.projectDir}"
 println "copying into ${project.pluginInstallDir}"
 println "copying include ${project.pluginXmlFile}"
}
  task copyPluginXml(type: Copy, dependsOn: initPluginInstallDir ) {
 from
  { project.projectDir }
 into
  { project.pluginInstallDir }
 include { project.pluginXmlFile }
}

:initPluginInstallDir Plugin Install Dir= C:\Users\me\dev\TheSDK\Plugins\ca.companyname.CommonTesting copying from C:\Users\me\dev\TheProject\ThePlugins\TESTING\CommonTesting copying into C:\Users\me\dev\TheSDK\Plugins\ca.companyname.CommonTesting copying include plugin.xml :copyPluginXml

FAILURE: Build aborted because of an internal error.


(Scott Palmer) #10

Here is the full stack trace. (I just re-ran it after deleting the .gradle folder to make sure it was a clean run.

:copyPluginXml

FAILURE: Build aborted because of an internal error.

  • What went wrong: Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.

  • Try: Run with --debug option to get additional debug info.

  • Exception is: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean

at $Proxy31.isSatisfiedBy(Unknown Source)

at org.gradle.api.specs.OrSpec.isSatisfiedBy(OrSpec.java:39)

at org.gradle.api.specs.AndSpec.isSatisfiedBy(AndSpec.java:41)

at org.gradle.api.specs.AndSpec.isSatisfiedBy(AndSpec.java:41)

at org.gradle.api.internal.file.collections.DirectoryFileTree.isAllowed(DirectoryFileTree.java:172)

at org.gradle.api.internal.file.collections.DirectoryFileTree.walkDir(DirectoryFileTree.java:149)

at org.gradle.api.internal.file.collections.DirectoryFileTree.visit(DirectoryFileTree.java:119)

at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(FileTreeAdapter.java:96)

at org.gradle.api.internal.file.AbstractFileTree.isEmpty(AbstractFileTree.java:48)

at org.gradle.api.internal.file.CompositeFileCollection.isEmpty(CompositeFileCollection.java:57)

at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:36)

at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)

at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)

at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)

at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)

at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)

at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)

at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)

at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:3 1)

at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)

at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.j ava:79)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java :29)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)

at org.gradle.launcher.daemon.protocol.Build.run(Build.java:68)

at org.gradle.launcher.daemon.protocol.Build.run(Build.java:64)

at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:45)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:28)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:116)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:114)

at org.gradle.util.Swapper.swap(Swapper.java:38)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:114)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:61)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.HandleClientDisconnectBeforeSendingCommand.execute(HandleClientDisconnectBeforeSend ingCommand.java:21)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.StopConnectionAfterExecution.execute(StopConnectionAfterExecution.java:27)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)

at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:55)

at org.gradle.launcher.daemon.server.Daemon$1$1.run(Daemon.java:123)

at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

at java.lang.Thread.run(Thread.java:722)

BUILD FAILED

Total time: 4.959 secs


(Luke Daley) #11

The include of ‘copyPluginXml’ is wrong. It should be:

task copyPluginXml(type: Copy, dependsOn: initPluginInstallDir ) {
    from
  { project.projectDir }
    into
  { project.pluginInstallDir }
    include { it.file == project.pluginXmlFile }
}

The closure passed to include receives a javadoc:org.gradle.api.file.FileTreeElement for each file that might be copied. You needed to compare this to the file you wanted.


(Scott Palmer) #12

Thanks, obviously my conversion to use closures needs some attention.


(Scott Palmer) #13

Now I find that my cleanup code fails to delete directories… but it seems to be a Gradle/Groovy problem. I can run the same cleaning task over and over and eventually all of the folders are deleted, but it always fails first… then the nest run it gets farther and fails on a different folder… repeat and eventually all the folders are deleted. (This is code that seemed to work in milestone-8 … I’m in the process of migrating the code to 1.0-rc-3)

About to delete: C:\Users\me\dev\TheSDK\Plugins\ca.companyname.CommonTesting

FAILURE: Build failed with an exception.

  • Where: Script ‘C:\Users\me\devTheSDK\BuildScripts\Defaults.gradle’ line: 319

  • What went wrong: Execution failed for task ‘:cleanInstalledPlugin’. > java.io.IOException: Unable to delete directory C:\Users\me\dev\TheSDK\Plugins\ca.companyname.CommonTesting.

  • Try: Run with --info or --debug option to get more log output.

  • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:cleanInstalledPlugin’.

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)

at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:3 4)

at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)

at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200)

at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172)

at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198)

at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:111)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateC acheAccess.java:83)

at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)

at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)

at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)

at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)

at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)

at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)

at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)

at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)

at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)

at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)

at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)

at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:3 1)

at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)

at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)

at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)

at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.j ava:79)

at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java :29)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)

at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)

at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)

at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:31)

at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:20)

at org.gradle.launcher.Main.doAction(Main.java:48)

at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.Main.main(Main.java:39)

at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:32)

at org.gradle.launcher.GradleMain.main(GradleMain.java:24) Caused by: org.gradle.api.UncheckedIOException: java.io.IOException: Unable to delete directory C:\Users\me\dev\TheSDK\Plugins\ca.companyname.CommonTesting.

at org.gradle.util.GFileUtils.deleteDirectory(GFileUtils.java:257)

at org.gradle.api.internal.file.copy.DeleteActionImpl.delete(DeleteActionImpl.java:50)

at org.gradle.api.internal.file.DefaultFileOperations.delete(DefaultFileOperations.java:128)

at org.gradle.api.internal.project.AbstractProject.delete(AbstractProject.java:707)

at org.gradle.api.Project$delete.call(Unknown Source)

at org.gradle.groovy.scripts.DefaultScript.delete(DefaultScript.groovy:153)

at Defaults_189l4d500te6hjhggl85bh06hq$_run_closure12.doCall(C:\Users\me\dev\TheSDK\BuildScripts\Defaults.gradle: 319)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:452)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:436)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)

… 53 more Caused by: java.io.IOException: Unable to delete directory C:\Users\me\dev\TheSDK\Plugins\ca.companyname.CommonTesting.

at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:981)

at org.gradle.util.GFileUtils.deleteDirectory(GFileUtils.java:255)

… 62 more

BUILD FAILED


(Scott Palmer) #14

The folder being deleted has subfolders. Each run some of the nested folders are removed, until finally the folder is gone. Here is the task:

// Clean installed plugin
task cleanInstalledPlugin() << {
 if( project.pluginInstallDir ) {
  println "About to delete: $project.pluginInstallDir"
  delete( project.pluginInstallDir )
 }
}

(Scott Palmer) #15

Fixed that one by changing to:

task cleanInstalledPlugin(type: Delete) {
    onlyIf { project.pluginInstallDir != null }
    delete {project.pluginInstallDir }
}

(Scott Palmer) #16

I spoke too soon. It still fails the same way sometimes.