Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

m2eclipse resource filtering

I've having problems with resource filtering using m2eclipse Maven support in Eclipse. 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 (e.g. ${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.

So, if I make a change to a property in my pom file, the filtering is not applied. However, if I then go to the file that references that property (e.g. a Spring config file) then edit and save it, the filtering is applied.

I did read somewhere that:

"m2eclipse skips filtering if there were no resource changes during incremental build"

I'm using m2eclipse 0.10.x

Has anyone else come across this?

Thanks,

Andrew

like image 692
DrewEaster Avatar asked May 05 '10 13:05

DrewEaster


1 Answers

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 skips filtering if there were no resource changes during incremental build

And my understanding is that this was a design choice (see the last message from Eugene):

There was concern that resource filtering may affect performance in the IDE and not always needed (e.g. when filtering is only used to store some stuff about build into the result 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).

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.

like image 65
Pascal Thivent Avatar answered Sep 28 '22 11:09

Pascal Thivent