Upgrading Maven 2 to 3

Maven 3 doesn’t have a huge number of visible improvements over Maven 2, but upgrading is easy and doesn’t pose a large risk. We encountered only a minor number of problems in the upgrade, the biggest ones related to how we had configured our Artifactory repo and Jenkins jobs.


  • Maven 3 is faster than Maven 2. Others have reported large improvements, but for us it wasn’t not really noticeable. It’s nice to have, but for our small to medium-size builds, Maven’s speed was never a problem.
  • Maven 3 has better error reporting and logging and we do notice this sometimes. It’s not a huge difference but it’s also nice.
  • Maven 3 is the platform for new and upcoming projects. It’s easier to embed, easier to extend, and promises to be the foundation for all new features. Our main reason for switching, in fact, was because the project to support flex code coverage requires it.
  • Other improvements like maven shell or polyglot maven might be interesting to play around with, but they’re not that useful to us now.

Upgrade Changes

  • Maven 3 is largely backwards compatible.  You can run it against your old Maven 2 poms without any changes and quite a bit will work just fine. That gave us confidence that the upgrade wouldn’t be a big deal.
  • Plugins defined in the old <reporting> section must be moved to <build>. The maven docs have more info on changes you have to make for reporting, which are not a big deal.
  • We did have a problem initially with getting the latest snapshot updates. Local repositories would show updated timestamps on maven-metadata.xml files, but not get the latest jars. It turned out that Maven 3 does not allow non-unique snapshots (<uniqueVersion>false</uniqueVersion>) but we still had our Artifactory repository configured for non-unique versions. Artifactory has a write-up on the issue, and changing the configuration solves the problem.
  • Finally, some of our Jenkins jobs could not resolve common plugins from Artifactory. The url for them showed ‘null’ instead of the name of the virtual repo, ie. ‘repo’. Maven 3 worked fine from the command-line, however. These jobs turned out to have been created as ‘free-style’ jobs that just invoked maven. Once we recreated them as ‘Maven 2/3’ jobs, everything worked fine. Extra Artifactory build configuration options showed up, as well. I’m sure there’s a way to correctly configure the free-style jobs, but we just changed them to maven jobs.
This entry was posted in java, software and tagged . Bookmark the permalink.

3 Responses to Upgrading Maven 2 to 3

  1. Javawerks says:

    So where is the ‘real’ M3 documentation? Please, no M2 documentation masquerading as M3 documentation.

    • tborthwick says:

      With projects like these, documentation often lags. Since Maven 3 is so backwards-compatible, it’s not hard to take the list of changes in Maven 3 and use them in combination with the Maven 2 docs to get information, but a consolidated set of Maven 3 docs would be nice.

  2. estiedi says:

    I had big issues upgrading the site creation of my projects. And indeed, finding documentation on how this is supposed to be done in M3 is lacking.Backwards compatible? Yes, but not for site creation.

Leave a Reply

Your email address will not be published. Required fields are marked *