When training the Maven Fundamentals or Advanced Maven Techniques classes or reading the Apache Maven users mailing list, it seems that again and again Maven 2 pops up. Sometimes even the long dead Maven 1 creeps up now and then. Usually my first two questions to somebody using Maven 2 are Why? and Are you sure?
The answer to the "Why?" is often a mumbling about not enough time to upgrade and upon closer inspection, I find that it was never honestly tried. It seems there is still a perception out there that Maven 3 is a new major version and is largely incompatible. However - that is completely false! It was true way back when Maven 1 was replaced by Maven 2, but is not true for the move to Maven 3. In fact, apart from a few minor edge cases, Maven 3 will work as a complete drop in replacement for Maven 2 with improved performance, better error reporting and many more enhancements.
One of the main goals for Maven 3 was to make it more suitable for embedding Maven in tools like an IDE or a CI server. This brings me to the second question "Are you sure?". When asking about the IDE used for development on the project in question, the most frequent answer is Eclipse. I then find that a stock install of Eclipse with the m2Eclipse plugin, as provided in the last two Eclipse releases, is used. These integrations embed Maven 3 and therefore any work you do with your project in the IDE is actually using Maven 3. Assuming that it works, you are ready to move to Maven 3 on the command line. That is pretty much always the case since how would the developers otherwise do any work?
Now some people object that they have in fact configured Eclipse to use an external install of Maven 2. While that is correct and works for any execution of Maven from Eclipse that uses the "Run/Debug as Maven" features you are still using Maven 3 in many cases. In fact, compilation of your source on the fly, any POM editor work as well as "Run As - junit-tests" and "Run As - Java Application" is still being done by the embedded Maven 3. So whatever you do...you will most likely have Maven 3 in the mix. And realistically a mixed use case like that will be more complex and troublesome than an outright upgrade to Maven 3. Try it!
Writing extensions for sophisticated integrations and plugins like Tycho used for Eclipse and OSGi related development with Maven OS is in fact only possible with Maven 3 and therefore you may already be using Maven 3 for use cases like this.
With this knowledge and understanding you should now be ready to install Maven 3 and benefit from its increased performance and maybe fix some of the errors in your pom that it will find. While you're at it, you should probably start creating a company POM and controlling your plugin versions used in your Maven builds. Then you could upgrade e.g. to the new Maven Compiler Plugin 2.5.1 and get another performance boost for your builds. To make sure that nobody sneaks in the creaky Maven 2, you could introduce a Maven Enforcer Plugin usage ...
If you would like to learn more about Maven usage tips and tricks, you can join me in one of our upcoming virtual Maven training classes. -- Or join me in our upcoming Nexus virtual training class to find out why and how you should really be using a repository manager with any build system that has built in dependency management (and they all do today).
See you then,