eclipse 如何在eclipse中删除maven项目的目标文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22652483/
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
how to delete target folder of maven project in eclipse
提问by kasson
I cannot clean the maven project. who know the best way,thanks.
我无法清理 Maven 项目。谁知道最好的方法,谢谢。
the maven project in eclipse.
eclipse 中的 maven 项目。
when i run mvn clean package,first it will run successful
当我运行 mvn clean package 时,首先它会运行成功
two times after, i cannot do it will get error.
两次后,我不能这样做会出错。
Deleting C:\Codes...\target
删除 C:\Codes...\target
BUILD ERROR
构建错误
Failed to clean project: Failed to delete C:\Codes...\target
无法清理项目:无法删除 C:\Codes...\target
I already tried to shut dowm eclipse is still error.
我已经尝试关闭 dowm eclipse 仍然是错误的。
i trid to login off and login in and it will be ok;
我尝试注销并登录,它会没事的;
but it not a good way to solve it .
但这不是解决问题的好方法。
who know other way,thanks!
谁知道其他方法,谢谢!
回答by Sasikumar Murugesan
Some file of the target folder is locked by another program or you may not have permission to delete folder
目标文件夹的某些文件被其他程序锁定或您可能没有删除文件夹的权限
so go and delete folder manually by using Windows Explorer if not open a windows explorer with administrative right and then go to that folder and delete.
因此,如果没有打开具有管理权限的 Windows 资源管理器,请使用 Windows 资源管理器手动删除文件夹,然后转到该文件夹并删除。
now you can run mvn clean install it will works fine.
现在您可以运行 mvn clean install 它会正常工作。
回答by Lokesh
It is not able to delete because you must be accessing some file from it. So simple solution would be to close any files which you might have opened from target folder [inside or outside eclipse]. Once you dont access the folder or any of its contents then folder shld get deleted.
它无法删除,因为您必须从中访问某个文件。如此简单的解决方案是关闭您可能从目标文件夹 [eclipse 内部或外部] 打开的任何文件。一旦您不访问该文件夹或其任何内容,则文件夹 shld 将被删除。
回答by Niels Bech Nielsen
If you continue to have this problem, you have something of a bother.
如果你继续遇到这个问题,你就有麻烦了。
As Lokesh explains, something is holding a file handling, preventing maven from deleting the directory. It could be eclipse, or something from the build, it can be hard to spot.
正如 Lokesh 所解释的,有些东西正在处理文件,阻止 maven 删除目录。它可能是日食,也可能是构建中的某些东西,很难发现。
If there are any files in the non-removable directory, they may provide you with a clue.
如果不可移动目录中有任何文件,它们可能会为您提供线索。