Eclipse:由于错误,项目未构建

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13572063/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:29:27  来源:igfitidea点击:

Eclipse: The project was not built due to error

eclipsests-springsourcetoolsuite

提问by Robert

I get this error message whenever I create new Spring MVC projects in Eclipse STS.

每当我在 Eclipse STS 中创建新的 Spring MVC 项目时,我都会收到此错误消息。

The project was not built due to "Error deleting resource '/ProjectName/target/classes/log4j.xml' from the workspace tree." Fix the problem, then try refreshing this project and building it since it may be inconsistent.

The project was not built due to "Error deleting resource '/ProjectName/target/classes/log4j.xml' from the workspace tree." Fix the problem, then try refreshing this project and building it since it may be inconsistent.

Why is this happening? I haven't changed anything and the file located at classes\log4j.xmlexist on the file system. When I try to import the files, Eclipse tells me that I can't because the source is already existing in the project (even though it's telling me it has been deleted).

为什么会这样?我没有改变任何东西,位于classes\log4j.xml文件系统上的文件存在。当我尝试导入文件时,Eclipse 告诉我不能,因为源已经存在于项目中(即使它告诉我它已被删除)。

回答by Vaishak Suresh

This may be because the file/folder is locked and eclipse could not delete it. Try re-starting Eclipse. If that doesn't work, manually delete the files. Since it is in classes folder, it will get re-created when you build.

这可能是因为文件/文件夹被锁定,eclipse 无法删除它。尝试重新启动 Eclipse。如果这不起作用,请手动删除文件。由于它在 classes 文件夹中,因此在构建时会重新创建。

If all else fails, try restarting the machine.

如果一切都失败了,请尝试重新启动机器。