Alex Rivera | Logout

Build single module from multimodule pom

Asked 2009-10-23T11:35:46.627
9

Is it possible to do?

The environment: Multimodule pom consists of 3 modules: mm1, mm2, mm3. Module mm2 has mm1 as dependency. It is possible to build parent pom without any errors.

The question: Is it possible to build single module mm2 (i.e., run maven from mm2 base directory) without installing mm1 into local repository?

Thanks.

Edit
Report

1 Answer

14

I'm not sure what you mean exactly by "without installing mm1 into local repository". Do you mean previously to building mm2 or never?

In doubt, maybe one of the new build options announced in the Maven Tips and Tricks: Advanced Reactor Options blog post can help:

Starting with the Maven 2.1 release, there are new Maven command line options which allow you to manipulate the way that Maven will build multimodule projects. These new options are:

-rf, --resume-from
        Resume reactor from specified project
-pl, --projects
        Build specified reactor projects instead of all projects
-am, --also-make
        If project list is specified, also build projects required by the list
-amd, --also-make-dependents
        If project list is specified, also build projects that depend on projects on the list

I was specifically thinking to the -pl and -am options. To build a subset of the modules, run the following from the root directory

$ mvn --projects mm2 --also-make install

However, I'm not sure this answers your question (which is not totally clear for me).

answered 2009-10-23T12:39:28.040

Your Answer