How does IntelliJ's Maven filtering support work?

intellij-idea, maven

Solution

IntelliJ IDEA's Make features are capable of filtering Maven resources. However, IntelliJ IDEA yet does not support filtering web resources.

source: http://www.jetbrains.com/idea/webhelp/maven.html#compile No further details about this support in whole intellij webhelp though, so I guess it should work just like maven's process-resources phase does.

The problems you are having can be caused by the fact that directory `src/integrationtest/resources` doesn't follow maven conventions. Maybe it will work if you:

- make it `src/test/resources/integrationtest/`

or

- configure maven to respect `src/integrationtest` as test sources (but if `integrationtest` isn't well-known convention it will be violation of maven's COC rule)

or

- make it another maven (sub)module, if you want to emphasize isolation of `integrationtest`

As for filtering directories different that `src/main/resources`: filtering `src/main/webapp/META-INF` worked out-of-a-box for me. (Maven 3.0.4, Intellij 12.1.4)

Problem

I have noticed when you configure a Maven project to use property filtering the property filtering seems to also work during a non-maven IntelliJ "make". This means the IntelliJ run configurations for Jetty/Tomcat/GWT/Glassfish will still honour your maven resource filtering. So if I add this to my `pom.xml`: ``` <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/*.properties</include> <include>**/persistence.xml</include> </includes> </resource> .... ``` It should filter any properties in my properties and peristence.xml files before any intellij run configurations start. This is very usefull for swapping in JDBC references or filesystem parameters. The only problem I am having is that IntelliJ only seems to honour filtering in src/main/resources even if I change pom.xml to have a second entry for other directories (ie:src/integrationtest/resources). This all seems to be "automagical". So how does it work and where (if anywhere) can I configure it?

Original source