Wednesday, February 11, 2009

Releasing Multi-Module Maven Projects

When you're doing a release using the Maven release plugin, Maven likes to ask you what version you'd like to release and what the version should be after the release.  For final releases, the defaults are often sensible, and you can accept them by turning on batch mode.  For interim releases, they usually aren't.

When you're doing this with a single project or a project with a very small number of modules, answering those questions for each module isn't such a big deal.  When you're working with a project with a larger number of modules, this gets very tedious very quickly.  The batch mode example  suggests that you can pre-specify the release version for each module, but it fails to highlight the property that a friend of mine just pointed out: autoVersionSubmodules.  That'll save me a lot of pain in the future.


Joshua said...

Thanks for the tip. The version propagation from the aggregator works well, but unfortunately the mvn release:prepare command fails for me while it's comitting. It looks like it's trying to add the sub-module pom.xml file, but it already exists from the prior svn cp that it uses to create the branch. Any ideas?

Geoffrey Wiseman said...

Doesn't ring a bell for me; try posting a detailed error description to the Maven user list?