简体   繁体   English

从eclipse构建中删除资源文件夹的排除?

[英]Remove exclusion of resources folder from eclipse build?

I imported my existing maven projects under eclipse.Once imported i found under Java Build Path > Source resource foulder is excluded(i can see Excluded:** ) from build and does not get copied under target > classes directory. 我在eclipse下导入了我现有的maven项目。一旦在Java Build Path>源资源foulder下找到导入的我从构建中被排除(我可以看到Excluded:** )并且不会被复制到target> classes目录下。

I can remove exclusion manually by selecting Excluded:** and then click Remove, But there are large numbers of projects. 我可以通过选择Excluded:**然后单击Remove删除手动删除排除,但是有大量项目。 Is there a setting in eclipse where i can do it one go ? 在eclipse中有一个设置,我可以一个人去做吗?

That's part of what Maven does when you let it generate your Eclipse project settings (via the eclipse:eclipse plugin/goal). 当你让它生成你的Eclipse项目设置时,这是Maven所做的一部分(通过eclipse:eclipse插件/目标)。 It's quite misleading. 这很容易让人误解。 However, if you have the m2e plugins installed into Eclipse it coordinates things correctly. 但是,如果你将m2e插件安装到Eclipse中,它可以正确地协调事物。

What's going on, as best as I can figure: Eclipse's built-in Java builder automatically copies non-Java files found on the build path to the output location (unless they're excluded as you see in your Build Path ). 正如我所能想到的那样:Eclipse的内置Java构建器会自动将构建路径中找到的非Java文件复制到输出位置(除非它们在构建路径中被排除在外)。 Problem is, when Maven comes in the picture it, too, wants to copy resources during a build. 问题是,当Maven进入图片时,它也想在构建期间复制资源。 So to keep the two builders from competing/interfering with each other, Maven instructs Eclipse to ignore resources so it (Maven) can manage copying them during a build. 因此,为了防止两个构建者相互竞争/干扰,Maven指示Eclipse忽略资源,以便它(Maven)可以管理在构建期间复制它们。

m2e integrates into the Eclipse build process to do the Maven copying of those files, so if you configure the project as an m2e project things will "just work," both in Eclipse and if you build from a command line. m2e集成到Eclipse构建过程中以对这些文件进行Maven复制,因此如果将项目配置为m2e项目,那么在Eclipse中以及从命令行构建时,事情将“正常工作”。

I don't know of a way to tell Maven to not configure the project this way. 我不知道告诉Maven 以这种方式配置项目的方法。 To be honest, that's just one of the reasons I prefer to not let Maven generate my Eclipse project files; 说实话,这只是我不想让Maven生成我的Eclipse项目文件的原因之一; I do a much better job of it and I totally control the specifics rather than relying on whatever the Maven eclipse developers think is best. 我做得更好,我完全控制细节而不是依赖Maven eclipse开发人员认为最好的东西。

This is an old question, but I've been looking for the answer and I finally dug it up myself. 这是一个老问题,但我一直在寻找答案,我终于把它挖出来了。 According to the M2Eclipse FAQ the import intentionally excludes resources. 根据M2Eclipse FAQ ,导入故意排除资源。 This is because Maven performs special resource handling that includes filtering. 这是因为Maven执行包括过滤的特殊资源处理。

Let Maven do the building for you. 让Maven为您做这座建筑。 Disable automatic building in Eclipse and never build your projects in Eclipse. 禁用Eclipse中的自动构建,永远不要在Eclipse中构建项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM