Spoiler Alert: Upcoming Maven 3.4.0 - Changes - III

Currently the preparations for the upcoming Maven 3.4.0 release is running. There had been informations about the changes for the next Maven release.

I will give some more information about changes which are (might be!) part of the next Maven release.

Just be warned that you do not blame me if a particular issue will not part of the final release. This is written from the current perspecitve. So no warranty about that.

I assume that you know filtering in resources can simply be achieved by configuring things like this in your pom file:

1  ...
2  <resources>
3    <resource>
4      <directory>src/main/resources</directory>
5      <filtering>true</filtering>
6    </resource>
7  </resources>
8...

But this configuration has one drawback. It will filter everything, except files with pre defined extensions like jpg, jpeg, gif, bmp, png.

Often in builds you need have supplemental files which should be filered or not filtered. So the consequence is to enhance the configuration and adding those extensions/folders etc. Or you know that you have some folders in that above tree which contain files which should not be filtered eithers. This often ends up with a bunch of includes/excludes etc. which is simply cumbersome.

The best and simplest solution would be having two different locations for filtered and non-filtered files. So a configuration in your pom could look like this:

 1  ...
 2  <resources>
 3    <resource>
 4      <directory>src/main/resources</directory>
 5    </resource>
 6    <resource>
 7      <directory>src/main/filtered-resources</directory>
 8      <filtering>true</filtering>
 9    </resource>
10  </resources>
11...

So this setup makes it easier and more clean where the files are located which will be filtered and the ones which will not. The same could of course be applied to the src/test area.

By improving the Conventions over Configuration paradigm in Maven 3.4.0 the super pom contains such an configuration for the src/main/resources, src/main/filtered-resources, as well as for the src/test/resources, src/test/filtered-resources.