New Maven 3.3.1 Features: Better Multi-Module Project Support

Maven has always had a loosely defined notion of a multi-module project, but we are starting to move toward a more cohesive definition along with a few new features that illustrate this. There is still more work to do, but one key point to note is that Takari’s upcoming Continuous Delivery work is predicated on a well defined notion of a multi-module project for cohesive versioning. People have worked around this missing definition and it’s implied in many places in Maven but when Maven 4.0 is released it will be well-defined and be used by at least two sub-systems Takari is building.

The first two things that have changed in this respect are the .mvn directory and the new maven.multiModuleProjectDirectory property. The bootstrap scripts shipped with Maven 3.3.1 will try and find a .mvn directory in your project if they can. It is expected that you only have one .mvn directory for a given multi-module project. We have started using this directory as a key for three new files that can be contained within that directory.

The new dynamic core extension loading mechanism works by looking for an extensions.xml file in this directory, and there are two new files that can be used as well. There is now a jvm.config file which allows you to specify any JVM level parameters that you need for your build, and it might look something like:

-Xmx512m
-Djava.awt.headless=true

Where users no longer have to be instructed to populate their MAVEN_OPTS envar in order to make the build work. We borrowed this format from the Facebook Presto jvm.config definition as they use it. It also looks very similar to the JVM options you can find in an eclipse.ini file.

The bootstrap scripts also look for a maven.config file as well where you can specify specific Maven parameters. Say you have enabled the Takari Smart Builder for your build and you always want to use eight thread, and additionally always emit the stack trace on errors. You would have something that looks like the following:

-T8
--builder smart
-e

This is the start, but expect a cohesive definition of a multi-module project coming in the next few versions of Maven with the goal of it being fully defined for Maven 4.0 which is when I will recommend people trying to adopt and use the APIs that are created. Much of this work is in a usable prototype stage but is functioning for Takari’s Continuous Delivery system we call Generations.

 

Comments

Maven Training

To use Maven correctly you'll need to understand the fundamentals. This class is designed to deliver just that.

Introduction to Maven
 

Stay Connected

 

Newsletter

Subscribe to our newsletter and stay up to date with the latest news and events!