Project cleaning can fail on Windows:

12:40 | INFO  | s.e.m.b.GenerateSourcesBuilder - Cleaning and generating sources for language project eclipse:///relations
12:40 | ERROR | s.e.m.b.GenerateSourcesBuilder - Cannot clean language project eclipse:///relations; build failed unexpectedly
org.apache.commons.vfs2.FileSystemException: Could not delete "eclipse:///relations/include/relations-java.jar".
	at org.apache.commons.vfs2.provider.AbstractFileObject.deleteSelf(AbstractFileObject.java:848) ~[commons-vfs2-2.0.jar:2.0]
	at org.apache.commons.vfs2.provider.AbstractFileObject.delete(AbstractFileObject.java:907) ~[commons-vfs2-2.0.jar:2.0]
	at org.metaborg.spoofax.meta.core.SpoofaxMetaBuilder.clean(SpoofaxMetaBuilder.java:200) ~[org.metaborg.spoofax.meta.core_1.5.0.20160115-163802-new-spoofax-plugin.jar:na]
	at org.metaborg.spoofax.eclipse.meta.build.GenerateSourcesBuilder$2.run(GenerateSourcesBuilder.java:73) ~[org.metaborg.spoofax.eclipse.meta_1.5.0.20160115-163802-new-spoofax-plugin.jar:na]
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2241) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.metaborg.spoofax.eclipse.meta.build.GenerateSourcesBuilder.clean(GenerateSourcesBuilder.java:83) [org.metaborg.spoofax.eclipse.meta_1.5.0.20160115-163802-new-spoofax-plugin.jar:na]
	at org.metaborg.spoofax.eclipse.meta.build.Builder.clean(Builder.java:70) [org.metaborg.spoofax.eclipse.meta_1.5.0.20160115-163802-new-spoofax-plugin.jar:na]
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:736) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) [org.eclipse.equinox.common_3.7.0.v20150402-1709.jar:na]
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) [org.eclipse.equinox.common_3.7.0.v20150402-1709.jar:na]
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:262) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:402) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.resources.Project$1.run(Project.java:556) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2241) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:534) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.resources.Project.build(Project.java:111) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.ui.internal.ide.dialogs.CleanDialog.doClean(CleanDialog.java:323) [org.eclipse.ui.ide_3.11.0.v20150825-2158.jar:na]
	at org.eclipse.ui.internal.ide.dialogs.CleanDialog$1.runInWorkspace(CleanDialog.java:153) [org.eclipse.ui.ide_3.11.0.v20150825-2158.jar:na]
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39) [org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) [org.eclipse.core.jobs_3.7.0.v20150330-2103.jar:na]
Caused by: org.eclipse.core.internal.resources.ResourceException: Problems encountered while deleting resources.
	at org.eclipse.core.internal.resources.Resource.delete(Resource.java:794) ~[org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.eclipse.core.internal.resources.Resource.delete(Resource.java:749) ~[org.eclipse.core.resources_3.10.1.v20150725-1910.jar:na]
	at org.metaborg.spoofax.eclipse.resource.EclipseResourceFileObject.doDelete(EclipseResourceFileObject.java:185) ~[org.metaborg.spoofax.eclipse_1.5.0.20160115-163802-new-spoofax-plugin.jar:na]
	at org.apache.commons.vfs2.provider.AbstractFileObject.deleteSelf(AbstractFileObject.java:837) ~[commons-vfs2-2.0.jar:2.0]
	... 23 common frames omitted

Restarting Eclipse, canceling the update editors will allow a clean.

Eclipse: epp.package.java 4.5.1.20150917-1200
Spoofax: org.metaborg.spoofax.eclipse 1.5.0.20160115-163802-new-spoofax-plugin
System: Windows 10 amd64 10.0
Submitted by Daco Harkes on 29 January 2016 at 12:47

On 29 January 2016 at 12:52 Gabriël Konat commented:

That’s a Windows issue, it likes to lock files, which then cannot be deleted. I cannot do anything about that, unless if you know of a way to unlock and delete files on Windows via Java.


On 29 January 2016 at 16:12 Daco Harkes commented:

Maybe graceful degradation?


On 24 February 2016 at 15:10 Gabriël Konat tagged windows

On 12 August 2018 at 00:18 Oskar van Rest commented:

I’m experiencing the same issue when running a language via the Java API and invoking Spoofax.close(). Below a minimal example to reproduce, on Windows only. Maybe on Windows it then shouldn’t try to delete the files so that at least it doesn’t produce the warnings and clutter the logs? (= ugly but better than nothing)

package my.example;

import org.metaborg.spoofax.core.Spoofax;
import java.net.URL;
import org.apache.commons.vfs2.FileObject;
import org.metaborg.core.language.ILanguageDiscoveryRequest;

public class Main {

  public static void main(String[] args) throws Exception {

    try(Spoofax spoofax = new Spoofax()) {
      URL url = Main.class.getClassLoader().getResource("pgql-1.1.spoofax-language");
      FileObject location = spoofax.resourceService.resolve("zip:" + url + "!/");
      Iterable<ILanguageDiscoveryRequest> requests = spoofax.languageDiscoveryService.request(location);
    }
  }
}
WARNING: Could not clean up temporary file "tmp_15456_pgql-1.1.spoofax-language".
org.apache.commons.vfs2.FileSystemException: Could not delete "file:///C:/Users/ovanres/AppData/Local/Temp/vfs_cache4685132232982270235/tmp_15456_pgql-1.1.spoofax-language".
        at org.apache.commons.vfs2.provider.AbstractFileObject.deleteSelf(AbstractFileObject.java:553)
        at org.apache.commons.vfs2.provider.AbstractFileObject.delete(AbstractFileObject.java:496)
        at org.apache.commons.vfs2.provider.AbstractFileObject.deleteAll(AbstractFileObject.java:516)
        at org.apache.commons.vfs2.impl.DefaultFileReplicator.deleteFile(DefaultFileReplicator.java:173)
        at org.apache.commons.vfs2.impl.DefaultFileReplicator.close(DefaultFileReplicator.java:111)
        at org.metaborg.core.resource.ResourceService.close(ResourceService.java:53)
        at org.metaborg.core.MetaBorg.close(MetaBorg.java:158)
        at my.example.Main.main(Main.java:19)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not delete "C:\Users\ovanres\AppData\Local\Temp\vfs_cache4685132232982270235\tmp_15456_pgql-1.1.spoofax-language".
        at org.apache.commons.vfs2.provider.local.LocalFile.doDelete(LocalFile.java:131)
        at org.apache.commons.vfs2.provider.AbstractFileObject.deleteSelf(AbstractFileObject.java:542)
        ... 13 more

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

@Oskar, that warning in the log comes from within Apache Commons VFS2. Probably the only way to turn those warnings off is to turn off all warnings or all logging of VFS.
The original issue is from Spoofax 1.x so I’m going to close this issue and let people open new issues with more relevant stack traces for Spoofax 2.x (as done in e.g. https://yellowgrass.org/issue/Spoofax/250)


On 11 June 2019 at 15:18 Jeff Smits closed this issue.

Log in to post comments