On Fri, 2004-02-13 at 13:58, James Higginbotham wrote:
> I've done some preliminary searching and reading of articles, docs, etc.
> regarding Maven and multiple-subprojects, but haven't been able to
> determine an answer to the following question: 
> 
> Assuming a project structure of:
> 
> Project
>     |
>     |--A
>     |
>     |--B
>     |
>     |--C
> 
> Where A depends upon B and C depends on A, the typical compile steps to
> build the entire project would be B->A->C. I've seen articles regarding
> the use of a reactor to provide a one-step method of making this compile
> happen for all subprojects.

Yes. The multiproject plugin does this beautifully.

> However, our project has a large number of
> modules and we'd like to build a subset of them for quicker testing
> purposes by running Maven from, for example, subproject A (should build
> and deploy only B and A, not C). This would prevent me from having to
> compile all modules to simply test a set of 3 modules and deploy an EAR
> with those components. Is this possible using typical Maven constructs?

Yes.

> What would be required to accomplish this using Maven?

See below.

> My first thought
> is that each subproject A,B, and C would have its own project-level
> Maven files as well as the master one that lives at the top level. Is
> this the right approach?

No, but close. You're correct that each subproject has its own
project.xml. Each declares the dependencies for that subproject.

If I remember correctly, one or more of the plugins don't like having
subprojects stored in subdirectories of the current directory. When I
set up our codebase to use multiproject, I set up the "master" project
at the same level in the directory tree instead of at the top:

  (top level dir)
    |
    +-- master
    |
    +-- A
    |
    +-- B
    |
    +-- C

The project.xml for A lists B as a dependency. The project.xml for C
lists A as a dependency. The project.xml in master is about as simple as
it can get without Maven complaining; most importantly, no dependencies
are declared in it.

Then you'll need to add to project.properties in master:

  maven.multiproject.basedir=..
  maven.multiproject.includes=A/project.xml,B/project.xml,C/project.xml

If you cd to master and run "maven -Dgoal=... multiproject:goal"
(replacing "..." with an appropriate goal), Maven should apply the goal
to the subprojects in the appropriate order.

Now, to be able to build a subset, create a directory at the same level
as master:

  (top level dir)
    |
    +-- master
    |
    +-- subset
    |
    +-- A
    |
    +-- B
    |
    +-- C

Copy project.xml and project.properties from master to subset. Edit
project.xml as necessary. Edit maven.multiproject.includes in
project.properties to list only the modules you want to include in this
subset. Build as above.

Hope this helps.

-- 
Craig S. Cottingham
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to