maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian E. Fox" <bri...@reply.infinity.nu>
Subject RE: m2 multiple parents
Date Fri, 07 Oct 2005 14:05:51 GMT
Thank you, this helps a lot. 

-----Original Message-----
From: David Jackman [mailto:David.Jackman@fastsearch.com] 
Sent: Friday, October 07, 2005 9:37 AM
To: Maven Users List
Subject: RE: m2 multiple parents

With my understanding, one project can be set up to build any projects
it wants--those project don't have to list the one project as a parent.
Here's an example.  Say I have three projects (A, B, and C) that each
build some jar.  I have a parent project (called Parent) that is a POM
project, and A, B, and C all list that as their parent in their POMs:
  <parent>
    <groupId>maventest</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>
I can declare the pom.xml for parent like this:
  <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>maventest</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Parent POM for MavenTest</name>
    <packaging>pom</packaging>
  </project>
And that's it.  In other words, I'm not using the parent project to
build anything.  It's just the parent (and can provide additional
dependency information and other things).

I can set up other projects for the purpose of building multiple
projects at once.  And I can set up as many of those as I want.  Here's
the project called Multi-1:
  <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>maventest</groupId>
    <artifactId>multi-1</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>MavenTest Multi Project 1</name>
    <packaging>pom</packaging>
    <modules>
        <module>../parent</module>
        <module>../A</module>
    </modules>
  </project>
And here's another project called Multi-2:
  <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>maventest</groupId>
    <artifactId>multi-2</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>MavenTest Multi Project 2</name>
    <packaging>pom</packaging>
    <modules>
        <module>../multi-1</module>
        <module>../B</module>
        <module>../C</module>
    </modules>
  </project>

If I build multi-1, it builds the parent POM then project A.  If I build
multi-2, it builds multi-1 (which builds the parent POM and project A),
project B, and project C.  It will build them in the right order based
on their interdependencies, regardless of the order I list them.

The directory structur for these projects is completely flat (i.e.
parent, A, B, C, multi-1, and multi-2 are all sibling directories).

It's a very flexible system.  I do have a couple of questions, though,
if anyone more knowledgable than me is still reading:
1. Do my multi projects need to be declared as POM packaging?  These
projects really shouldn't package, install, or deploy anything (they're
only used to build other projects).
2. For the multi projects, I'm listing each project they build
explicitly.  Is it possible to tell Maven to build all the projects in
some directory subtree (using inclusions and exclusions like Maven 1
did)?

..David..


-----Original Message-----
From: Brian E. Fox [mailto:brianf@reply.infinity.nu]
Sent: Friday, October 07, 2005 6:39 AM
To: Maven Users List
Subject: RE: m2 multiple parents

Most of the time no, but it is possible that we will have a parent
project for each application that would cause a full rebuild. 

-----Original Message-----
From: Stephen Duncan [mailto:stephen.duncan@gmail.com]
Sent: Friday, October 07, 2005 8:34 AM
To: Maven Users List
Subject: Re: m2 multiple parents

If they're just used as part of multiple projects, then the modules
should probably just be declared as dependencies for those other
projects.  Do you really want to rebuild these modules every time you
build these other projects?

-Stephen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message