tags:

views:

255

answers:

3

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.

A: 

This goes against the principle of dependencies of Maven2. What is the interest of doing that exactly?

However, we can imagine to define the mm1 dependency of mm2 as a system dependency:

<dependency>
    <groupId>...</groupId>
    <artifactId>mm1</artifactId>
    <version>...</version>
    <scope>system</scope>
    <systemPath>../mm1/target/</systemPath>
</dependency>
romaintaz
This makes my eyes bleeding :)
Pascal Thivent
+1  A: 

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).

Pascal Thivent
+1 Now I see that I didn't read your post carefully and write nearly the same answer.
cetnar
+2  A: 
cetnar