简体   繁体   English

m2eclipse资源过滤

[英]m2eclipse resource filtering

I've having problems with resource filtering using m2eclipse Maven support in Eclipse. 我在Eclipse中使用m2eclipse Maven支持进行资源过滤时出现问题。 It seems that filtering only takes place on resources that have changed. 似乎只对已更改的资源进行过滤。 This is fundamentally flawed because, if I have a file that references properties (eg ${my.property}, if the value of the property changes, the filtering will only be performed if the referencing file is also modified - if I only change the property value (in my pom.xml), the filtering is not applied to the files that that reference it. 这基本上是有缺陷的,因为如果我有一个引用属性的文件(例如$ {my.property},如果属性的值发生更改,则只有在引用文件也被修改时才会执行过滤 - 如果我只更改了属性值(在我的pom.xml中),过滤不会应用于引用它的文件。

So, if I make a change to a property in my pom file, the filtering is not applied. 因此,如果我对pom文件中的属性进行了更改,则不会应用过滤。 However, if I then go to the file that references that property (eg a Spring config file) then edit and save it, the filtering is applied. 但是,如果我然后转到引用该属性的文件(例如Spring配置文件),然后编辑并保存它,则应用过滤。

I did read somewhere that: 我确实读过某个地方:

"m2eclipse skips filtering if there were no resource changes during incremental build" “如果在增量构建期间没有资源更改,m2eclipse会跳过过滤”

I'm using m2eclipse 0.10.x 我正在使用m2eclipse 0.10.x

Has anyone else come across this? 还有其他人遇到过这个吗?

Thanks, 谢谢,

Andrew 安德鲁

Yes, this is mentioned in this lengthy discussion (the topic is not exactly about resources filtering but the current behavior is mentioned): 是的,这是在这个冗长的讨论中提到的(主题并不完全是关于资源过滤,但提到了当前的行为):

When resource filtering is enabled, m2eclipse will run specified goals ("process-resources resources:testResources" by default) to filter resources into project's output folder (target/classes or target-eclipse/classes) as part of Eclipse build. 启用资源过滤后,m2eclipse将运行指定的目标(默认情况下为“process-resources resources:testResources”),以将资源过滤到项目的输出文件夹(target / classes或target-eclipse / classes)中,作为Eclipse构建的一部分。 m2eclipse skips filtering if there were no resource changes during incremental build 如果在增量构建期间没有资源更改,m2eclipse会跳过过滤

And my understanding is that this was a design choice (see the last message from Eugene): 我的理解是这是一个设计选择(参见Eugene的最后一条消息 ):

There was concern that resource filtering may affect performance in the IDE and not always needed (eg when filtering is only used to store some stuff about build into the result jar) 有人担心资源过滤可能会影响IDE中的性能而并不总是需要(例如,当过滤仅用于存储有关构建到结果jar中的一些内容时)

So, after a change in your POM, you should update the project configuration: right-click on your project then Maven > Update Project Configuration (and this will trigger process-resources ). 因此,在更改POM之后,您应该更新项目配置: 右键单击项目,然后单击 Maven>更新项目配置 (这将触发process-resources )。

To my knowledge, this is still the current status. 据我所知,这仍然是目前的状态。 There are many issues about resource filtering though, maybe check to see if you can find an similar one. 关于资源过滤有很多问题,也许可以查看是否可以找到类似的问题。

Yes, you are right. 是的,你是对的。

You should open an issue in m2eclipse's bug tracker . 您应该在m2eclipse的bug跟踪器中打开一个问题。

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

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