Maven: Use filtering mechanism for text files not under "resources"?

I need to configure several XML files that are not under resources (in particular, they are in the EAR src / main / application project).

A filtering mechanism would be ideal for this, but my understanding (right?) Is that it only works for resources.

Is there a way to use file filtering in other directories than src / main / resources?

Thanks in advance.

+4
source share
1 answer

The Maven EAR plugin can filter the contents of src/main/application . As described in EAR Resource Filtering :

Source Filtering

Filtering the contents of the src/main/application directory or one specified by the earSourcesDirectory parameter as easy:

  <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <version>2.4.2</version> <configuration> <filtering>true</filtering> [...] </configuration> </plugin> </plugins> </build> 

Please note that standard properties are available for filtering. It is also possible to specify a set of properties files to add additional values ​​if necessary. The configuration below also uses the properties defined in src/main/filters/config.properties

  <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <version>2.4.2</version> <configuration> <filtering>true</filtering> <filters> <filter>src/main/filters/config.properties</filter> </filters> [...] </configuration> </plugin> </plugins> </build> 
+3
source

All Articles