During building I accasionally get the following error. Removing the target folder is still possible and after removing the build succeeds again. It seems to be independent of which project I build.

My Spoofax version is 2.5.3

12:28 | ERROR | o.m.s.e.m.b.CompileBuilder     - Exception thrown during build
org.metaborg.core.MetaborgException: java.nio.file.FileSystemException: <project>\target\pluto\generate-sources.dep: The process cannot access the file because it is being used by another process.

	at org.metaborg.spoofax.meta.core.build.LanguageSpecBuilder.compile(LanguageSpecBuilder.java:150) ~[org.metaborg.spoofax.meta.core_2.5.3.jar:na]
	at org.metaborg.spoofax.eclipse.meta.build.CompileBuilder$1.run(CompileBuilder.java:49) ~[org.metaborg.spoofax.eclipse.meta_2.5.3.jar:na]
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2289) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2316) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.metaborg.spoofax.eclipse.meta.build.CompileBuilder.build(CompileBuilder.java:69) [org.metaborg.spoofax.eclipse.meta_2.5.3.jar:na]
	at org.metaborg.spoofax.eclipse.meta.build.Builder.build(Builder.java:53) [org.metaborg.spoofax.eclipse.meta_2.5.3.jar:na]
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:795) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) [org.eclipse.equinox.common_3.10.0.v20180412-1130.jar:na]
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:216) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:259) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:312) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) [org.eclipse.equinox.common_3.10.0.v20180412-1130.jar:na]
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:315) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:367) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:388) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:501) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:401) [org.eclipse.core.resources_3.13.0.v20180512-1138.jar:na]
	at org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:177) [org.eclipse.ui.ide_3.14.0.v20180517-1842.jar:na]
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60) [org.eclipse.core.jobs_3.10.0.v20180427-1454.jar:na]
Caused by: java.nio.file.FileSystemException: <project>\target\pluto\generate-sources.dep: The process cannot access the file because it is being used by another process.

	at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86) ~[na:1.8.0_162]
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) ~[na:1.8.0_162]
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) ~[na:1.8.0_162]
	at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269) ~[na:1.8.0_162]
	at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) ~[na:1.8.0_162]
	at java.nio.file.Files.delete(Files.java:1126) ~[na:1.8.0_162]
	at build.pluto.PersistableEntity.read(PersistableEntity.java:131) ~[pluto-1.11.0.jar:na]
	at build.pluto.BuildUnit.read(BuildUnit.java:69) ~[pluto-1.11.0.jar:na]
	at build.pluto.builder.BuildManager.require(BuildManager.java:295) ~[pluto-1.11.0.jar:na]
	at build.pluto.builder.BuildManager.requireInitially(BuildManager.java:262) ~[pluto-1.11.0.jar:na]
	at org.metaborg.spoofax.meta.core.build.LanguageSpecBuilder.plutoBuild(LanguageSpecBuilder.java:324) ~[org.metaborg.spoofax.meta.core_2.5.3.jar:na]
	at org.metaborg.spoofax.meta.core.build.LanguageSpecBuilder.compile(LanguageSpecBuilder.java:140) ~[org.metaborg.spoofax.meta.core_2.5.3.jar:na]
Submitted by Gerben Oolbekkink on 20 May 2019 at 13:28

On 11 June 2019 at 15:05 Jeff Smits commented:

This bug has a proposed fix which may make it into the next Spoofax release: https://github.com/pluto-build/pluto/pull/13


On 20 January 2021 at 11:22 Jeff Smits commented:

The referenced fix made it into one of the newer Spoofax releases, see the release notes to see which one. There were more issues with file locking on windows which got fixed later and are either in 2.5.13 or going to be in 2.5.14.


On 20 January 2021 at 11:22 Jeff Smits closed this issue.

Log in to post comments