Failed to build in task :processResources b/c of Couldn't follow symbolic link on Windows


(Neon Ngo) #1

I have a Java Spring Boot Gradle project that is recently failing to build on my Windows 10 system when I created a symbolic link from the src/main/resources/static to some static html content.

Here is my build output running Gradle Wrapper 4.10

> Task :compileJava UP-TO-DATE
> Task :processResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Failed to capture fingerprint of input files for task ':processResources' property 'rootSpec$1' during up-to-date check.
> Could not list contents of 'C:\Users\MyUserName\my-project\src\main\resources\static'. Couldn't follow symbolic link.

* Exception is:
org.gradle.api.UncheckedIOException: Failed to capture fingerprint of input files for task ':processResources' property 'rootSpec$1' during up-to-date check.
        at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.fingerprintTaskFiles(CacheBackedTaskHistoryRepository.java:360)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.createExecution(CacheBackedTaskHistoryRepository.java:163)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.access$100(CacheBackedTaskHistoryRepository.java:76)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$1.getCurrentExecution(CacheBackedTaskHistoryRepository.java:123)
    at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.getStates(DefaultTaskArtifactStateRepository.java:200)
    at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:94)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:50)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
    at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
    at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.GradleException: Could not list contents of 'C:\Users\MyUserName\my-project\src\main\resources\static'. Couldn't follow symbolic link.
    at org.gradle.api.internal.changedetection.state.mirror.MirrorUpdatingDirectoryWalker$1.visitFile(MirrorUpdatingDirectoryWalker.java:97)
    at org.gradle.api.internal.changedetection.state.mirror.MirrorUpdatingDirectoryWalker$1.visitFile(MirrorUpdatingDirectoryWalker.java:76)
    at org.gradle.api.internal.changedetection.state.mirror.MirrorUpdatingDirectoryWalker.walkDir(MirrorUpdatingDirectoryWalker.java:76)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter.snapshot(DefaultFileSystemSnapshotter.java:178)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter.snapshotAndCache(DefaultFileSystemSnapshotter.java:162)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter.snapshotAndCache(DefaultFileSystemSnapshotter.java:146)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter.access$200(DefaultFileSystemSnapshotter.java:64)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter$3.create(DefaultFileSystemSnapshotter.java:209)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter$3.create(DefaultFileSystemSnapshotter.java:204)
    at org.gradle.cache.internal.ProducerGuard$StripedProducerGuard.guardByKey(ProducerGuard.java:115)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter.snapshotDirectoryTree(DefaultFileSystemSnapshotter.java:204)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter$FileCollectionVisitorImpl.visitDirectoryTree(DefaultFileSystemSnapshotter.java:268)
    at org.gradle.api.internal.file.collections.FileTreeAdapter.visitRootElements(FileTreeAdapter.java:125)
    at org.gradle.api.internal.file.CompositeFileCollection.visitRootElements(CompositeFileCollection.java:206)
    at org.gradle.api.internal.changedetection.state.DefaultFileSystemSnapshotter.snapshot(DefaultFileSystemSnapshotter.java:139)
    at org.gradle.internal.fingerprint.impl.AbstractFileCollectionFingerprinter.fingerprint(AbstractFileCollectionFingerprinter.java:54)
    at org.gradle.internal.fingerprint.impl.AbstractPathOnlyFileCollectionFingerprinter.fingerprint(AbstractPathOnlyFileCollectionFingerprinter.java:37)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository.fingerprintTaskFiles(CacheBackedTaskHistoryRepository.java:358)
    ... 34 more

BUILD FAILED in 2s
2 actionable tasks: 1 executed, 1 up-to-date

My build works fine if I remove the symbolic link. I am running the build in a Git Bash prompt on my Windows 10 and using Java 8.


(Neon Ngo) #2

I figured out my problem, I had created a “file” symbolic link under Windows 10 using the mklink command, when I meant to create a directory symbolic link.
e.g. previously, I created the like like so
mklink static c:\path\to\static_content

fix was to delete the bad file symbolic link:
del static

then create directory symbolic link using:
mklink /D static c:\path\to\static_content