SoftwareEntwicklung Beratung Schulung

A coders, hackers heaven.....Hm...I do not think so...

Spoiler Alert: Upcoming Maven 3.4.0 - Changes - III

| Comments

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
3
4
5
6
7
8
  ...
  <resources>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>true</filtering>
    </resource>
  </resources>
...

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
3
4
5
6
7
8
9
10
11
  ...
  <resources>
    <resource>
      <directory>src/main/resources</directory>
    </resource>
    <resource>
      <directory>src/main/filtered-resources</directory>
      <filtering>true</filtering>
    </resource>
  </resources>
...

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.

Comments