maven_logo_1024

Maven : Filter only a given type of files

As I lost 5 minutes with this problem which is basic I share it here to help others.
By default, the Maven resources plugin copy everything from src/[main|test]/resources into target/classes without touching anything.
If you want to filter only a given type of files (to speedup the process and to avoid to corrupt binary files for example) you’ll need activate the filtering for this type of files (using inclusions) and the default configuration for others files (using exclusions).
Here is a sample to filter only *.properties resources :


<resources>
<!-- Filter only property files -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes><include>**/*.properties</include></includes>
</resource>
<!-- Everything is using the default copy -->
<resource>
<directory>src/main/resources</directory>
<excludes><exclude>**/*.properties</exclude></excludes>
</resource>
</resources>

GD Star Rating
loading...
GD Star Rating
loading...

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>