Side-effects of using Maven3

After attending to Jason van Zyl’s session about Maven3 we decided to start using Maven 3 instead of the 2.2 we were using. Since it is fully backward compatible we made it run without making a change to our pom’s. However, what this version does add is generate warnings for all kinds of ‘misconfigurations’ in the poms. This does not lead to problems in this version but it might do so in future version, so it is better to solve this issues.
One warning we got was:

[WARNING]
[WARNING] Some problems were encountered while building the effective model for net.pascalalma.framework:rs-core:jar:2.0-SNAPSHOT
[WARNING] ‘build.plugins.plugin.version’ for org.apache.maven.plugins:maven-clean-plugin is missing. @
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]

So it appeared we forgot to mention the version for the clean plugin, so I added the (latest) version to the pom like shown here and went on:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-clean-plugin</artifactId>
  <version>2.4</version>
  <configuration>
    <filesets>
      <fileset>
        <directory>${basedir}</directory>
        <includes>
          <include>derby.log</include>
          <include>activemq-data</include>
          <include>.mule</include>
          <include>muleEmbeddedDB</include>
          <include>out</include>
        </includes>
      </fileset>
    </filesets>
  </configuration>
</plugin>

However, after some time we noticed that some of our unit tests started to fail while they were valid and we hadn’t touched the code. After some investigation it appeared the problem was caused by the maven-clean-plugin. The version I chose (2.4) is not able to remove complete directories (or at least not with the configuration as we shown above). For some reason, until adding the version, the plugin was using version 2.2. and that does know how to handle my configuration. So I changed the version of the clean-plugin to 2.2 and my tests work like a charm without warnings of Maven.

So although Maven3 does work without a change it does not mean you won’t run into issues. But it must be said that we would run into this issue sooner or later without Maven3. So we would suggest to start using Maven3 (or at least give it a try) as it will only improve the quality of your builds (and runs much faster ;-).

About Pascal Alma

Pascal is a senior IT consultant and has been working in IT since 1997. He is monitoring the latest development in new technologies (Mobile, Cloud, Big Data) closely and particularly interested in Java open source tool stacks, cloud related technologies like AWS and mobile development like building iOS apps with Swift. Specialties: Java/JEE/Spring Amazon AWS API/REST Big Data Continuous Delivery Swift/iOS
This entry was posted in Maven, Technical and tagged . Bookmark the permalink.