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.
- 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.xmlfiles, 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.