My new website on Artificial Intelligence and Machine Learning www.aimlfront.com

Upgrading from Maven2 to Maven3

Maven 3 aims to ensure backward compatibility with Maven 2, improve usability, increase performance, allow safe embedding, and pave the way to implement many highly demanded features.
Apache Maven3 is a maintenance release to fix a security issue "The default configuration of Apache Maven 3.0.4, when using Maven Wagon 2.1, disables SSL certificate checks, which allows remote attackers to spoof servers via a man-in-the-middle (MITM) attack"
Some of the important new features are,
  • Performance improvements
  • Parallel build of independent modules
  • Better dependency management

Steps to follow Upgrade from Maven2 to Maven3


  • Need to change versions of supprted maven plugins which you have in parent and submodule pom files.
       http://maven.apache.org/plugins/index.html
  • Maven3 follows version very strictly, which may create issues which are not before. Make sure you have proper versions and groupID properly.
  • ${version} is deprecated in Maven3, use ${project.version}.
  • Don't forget to change maven version wherever is available, preferable place should be in parent pom file.
  • In maven3 dependency management jars version can't be changed insubmodules even though you mentioned. Make sure have proper version. But in Maven have option to override the version from in sub modules.
  • ruleset schema has been changed for pmd in maven 3. If you have any custom pmd rules don't forget to change the scema version and format.
Maven3 is better than maven2 any things can be identified at build itself instead of deployment.
As per my practical knowledge Maven 3.2.5 doesn't have any issues.
Still If you face any issues check the Maven 3.x Compatibility Notes while migrating from maven 2.x to maven 3.x

Note : The upgrade procedure and issues depends on your project structure. In general scenarios it is straight forward upgrade, with minimum changes in your project poms. Cross check the profiles and versioning behavior and repository locations as per above points. Make sure to check the dependency management which is much strict in maven 3.

Maven 3 Installation

Download latest maven 3 version from website and get started. Better to uninstall maven2 and install maven3, To avoid any kind of issues

Maven Eclipse IDE integration

Integrate maven 3 with Eclipse, using Maven Eclipse plugin
Upgrade Eclipse plugin (m2eclipse, Eclipse m2e) for the same.

Maven 3 Parallel builds Usage

Check out the parallel builds functionality in Maven 3.
The command is as follows:
   mvn -T 4 clean install # Builds with 4 threads
   mvn -T 1C clean install # 1 thread per cpu core
   mvn -T 1.5C clean install # 1.5 thread per cpu core

You will see the performance improvements on the first build itself.
Just upgrade and enjoy faster and much robust build tool!