15:01:56.113 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.UncheckedIOException: java.io.IOException: The process cannot access the file because another process has locked a portion of the file 15:01:56.117 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.internal.hash.HashUtil.createHash(HashUtil.java:57)
Gradle is reporting this error when I try to build a native C++ lib under windows. Examining the file system access, Gradle is hashing every file stating in a path above the path where my library project is.
Z:\Work\Lib\LibUtil - library path Z:\Work\Lib - is where Gradle scans to generate the hashes.
What happens is gradle scans into the Libutil.gradle… path meaning it’s scan’s the file that stores the hashes. This is what causes the file locking problem.
I start the build inside the library path.
Z:\Work\Lib\LibUtil>gradle -d libutilStatic
3:01:56.0595643 PM java.exe 6024 CloseFile Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties SUCCESS
3:01:56.0596114 PM java.exe 6024 QueryOpen Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties.lock SUCCESS CreationTime: 3/24/2014 2:39:33 PM, LastAccessTime: 3/24/2014 2:39:33 PM, LastWriteTime: 3/24/2014 3:01:35 PM, ChangeTime: 3/24/2014 3:01:35 PM, AllocationSize: 56, EndOfFile: 55, FileAttributes: A 3:01:56.0596595 PM java.exe 6024 QueryOpen Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties.lock SUCCESS CreationTime: 3/24/2014 2:39:33 PM, LastAccessTime: 3/24/2014 2:39:33 PM, LastWriteTime: 3/24/2014 3:01:35 PM, ChangeTime: 3/24/2014 3:01:35 PM, AllocationSize: 56, EndOfFile: 55, FileAttributes: A 3:01:56.0596980 PM java.exe 6024 CreateFile Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties.lock SUCCESS Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 3:01:56.0597128 PM java.exe 6024 QueryBasicInformationFile Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties.lock SUCCESS CreationTime: 3/24/2014 2:39:33 PM, LastAccessTime: 3/24/2014 2:39:33 PM, LastWriteTime: 3/24/2014 3:01:35 PM, ChangeTime: 3/24/2014 3:01:35 PM, FileAttributes: A 3:01:56.0597200 PM java.exe 6024 CloseFile Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties.lock SUCCESS
3:01:56.0598440 PM java.exe 6024 CreateFile Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties.lock SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened 3:01:56.0598809 PM java.exe 6024 ReadFile Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties.lock FILE LOCK CONFLICT Offset: 0, Length: 4,096, Priority: Normal 3:01:56.0599783 PM java.exe 6024 CloseFile Z:\Work\Lib\LibUtil.gradle\1.11\taskArtifacts\cache.properties.lock SUCCESS