Eclipse自动刷新和Maven构建干扰

Eclipse自动刷新和Maven构建干扰

本文介绍了Eclipse自动刷新和Maven构建干扰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近配置了Eclipse(版本3.6),以便自动刷新工作区中的项目(Windows>首选项>常规>工作区>自动刷新)。



因为我更改了这个配置,当我尝试运行Maven(Maven从Eclipse)安装一个大项目时,我有以下问题:



[ERROR]无法执行目标org.apache.maven.plugins:maven-clean-plugin:2.4.1:项目上的clean(default-clean)ProjectName:无法清除项目:无法删除C:\ProjectName\target - > [帮助1 ]
[ERROR]
[ERROR]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[ERROR]使用-X开关重新运行Maven以启用完整的调试日志记录。
[ERROR]
[ERROR]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误] [帮助1] 关于此主题,但没有答案。我希望我提供足够的信息来了解这个问题。

解决方案

这是因为某些东西,很可能是eclipse,文件在刷新时,所以当maven尝试清理(即删除目标目录),它失败。不要自动刷新;我通常只有eclipse在最初运行时刷新工作空间。


I recently configured Eclipse (ver. 3.6) in order to make it automatically refresh projects in the workspace (Windows > Preferences > General > Workspace > Refresh Automatically).

Since I changed this configuration I have the following problem when I try to run Maven (Maven install from Eclipse) to build a big project:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project ProjectName: Failed to clean project: Failed to delete C:\ProjectName\target -> [Help 1][ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR][ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The problem occurs randomly (more or less 50% of the times I build a single project), but when I try to build 14 projects all together I always get this error somewhere.I think that the problem is that Maven is trying to delete files that are locked by Eclipse (that is refreshing the project). In fact it doesn't happen when I disable the "Refresh Automatically" option.

Does anybody know a trick to avoid this trouble?

I noticed there is another question "Eclipse automatically refresh resources and exclude build dir" about this topic, but there are no answers. I hope I provided enough information to understand the problem.

解决方案

This occurs because something, most likely eclipse, has a lock on the file during refresh so when maven tries to clean (i.e. delete the target directory), it fails. Don't refresh automatically; I typically only have eclipse refresh the workspace when it initially runs.

这篇关于Eclipse自动刷新和Maven构建干扰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 21:11