Maven / M2Eclipse总是排除我的资源 [英] Maven / M2Eclipse excludes my resources all the time

查看:119
本文介绍了Maven / M2Eclipse总是排除我的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$

b $ b

如果我检查属性>> Java构建路径>>源,我可以看到这两个文件夹有Excluded:**。



这个问题可以通过点击除去排除项来轻松解决,但真的很令人沮丧。



项目设置非常简单,它有一些模块和子模块,但没有什么花哨。我的pom.xml中没有关于资源,eclipse或其他任何配置选项(也许我应该?)。



另一个问题是Eclipse不断报告警告在目标目录中(在问题视图中),它不应该首先丢弃。



任何帮助都不胜感激。 p>

感谢提前,
标记



Ps:Springsource工具套件2.7.0.RELEASE,Maven集成对于Eclipse 0.12.1.20110112,Maven 2.2.1

解决方案

这是正确的行为。当前版本的M2E为Eclipse IDE中的自动构建过程提供了自己的贡献者。此构建过程考虑了生成资源和进程资源等的maven生命周期,即某些项目具有从配置生成资源并放入编译的输出文件夹的插件。



您在构建路径中查看的机制仅涉及内置于将一组输入源文件夹编译/汇编到输出文件夹中的Eclipse IDE。如果Maven和Eclipse都这样做会出现冲突/问题。



在M2E常见问题中有一个关于这个确切点的链接

如果您真正遇到资源不被复制的问题,可能我们可以解决为什么(因为这是另一回事),但您的主要问题是关于常见的M2E常见问题点。

也许你想升级到org.eclipse.m2e和靛蓝,因为很多Maven复杂的maven问题/用法我已经解决了或者有一个解释的解决方案





我建议您执行Run As - > Maven - > clean,然后一个项目 - >清洁然后启用自动构建(这是为了允许基于Eclipse的自动构建发生,不要使用运行方式 - > Maven来构建来测试这一点)。现在打开eclipse之外的文件管理器,并手动检查输出文件夹中您没有被认为是被复制的资源。你应该会发现他们在那里一样。





我同意(可能是验证)警告关于目标/ **目录中的项目,而Eclipse有办法手动将目标/ **目录从验证中排除,此选项不会超出项目清理(删除目标目录时)。



所以在一个大型项目中总是等待验证是有点烦人。



也许我试图看看一个Maven可以创建Eclipse连接器插件,以便做到这一点,即绑定到构建生命周期中,并自动在目标文件夹上应用排除验证。


I have two very annoying issues with Maven-Eclipse integration, from time to time it excludes all my resources in src/main/resources and src/test/resources from the build path.

If I inspect "Properties >> Java Build Path >> Source" I can see that these two folders have "Excluded: **".

The problem can be easily solved by clicking on "Remove" on the exclusions, but it is really-really frustrating.

The project setup is very simple, it has some modules and sub-modules, but nothing fancy. I don't have any configuration options in my pom.xmls regarding resources, eclipse or whatever (maybe I should?).

The other problem is that Eclipse keeps reporting warnings in the "target" directories (in the "Problems" view), where it shouldn't give a damn in the first place.

Any help is appreciated.

Thanks is advance, Mark

Ps: Springsource Tool Suite 2.7.0.RELEASE, Maven Integration for Eclipse 0.12.1.20110112, Maven 2.2.1

解决方案

This is correct behavior. Current version of M2E provide their own contributor to the automatic build process inside the Eclipse IDE. This build process takes into account the maven lifecycle for generate-resources and process-resources etc... i.e. some project have plugins that generate resources from configuration and put in the compiled output folder.

The mechanism you are looking at in the Build Path only relates to the Eclipse IDEs built in mechanism to compile/assembly a set of input source folders into the output folders. If both Maven and Eclipse did this there would be conflicts/problems.

There is a link in the M2E FAQ about this exact point http://wiki.eclipse.org/M2E_FAQ#Why_resource_folders_in_Java_project_have_excluded.3D.22.2A.22

If you are genuinely having problems with resources not being copied maybe we can work through why that is (since that is another matter), but your main question is about a common M2E FAQ point.

Maybe you want to upgrade to org.eclipse.m2e and Indigo as a lot of Maven complex maven issues/usage I have are mostly resolved or have an explained solution.

.

I would recommend you perform a "Run As -> Maven -> clean" and then a "Project -> Clean" then enable automatic bulding (this is to allow Eclipse based automatic build to take place, do not use Run As -> Maven to build to test this point). Now open a file manager outside eclipse and manually inspect the output folders for the resources that you did not think are being copied. You should find they are there just the same.

.

I agreed with the (probably Validation) warning about items in the target/** directory and whilst Eclipse has a way to manually exclude the target/** directory from validation this option does not stick beyond a project clean (when the target directory is deleted).

So it is somewhat annoying to be always waiting for validation of items in a large project.

Maybe I attempt to see if a Maven Eclipse connector plugin can be created provided to do this i.e. tie into the build lifecycle and automatically apply the Exclude Validation on the target folder.

这篇关于Maven / M2Eclipse总是排除我的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆