Apologies for the length, but it's mostly sample code...

I am reworking a multi-module project, using Maven 2.0.8, with the
following structure:

                                         master-project (pom)
              midlevel-project1 (pom)
midlevel-project2 (jar)
   war-project (war)     ear-project (ear)

master-project acts as both a parent and aggregator to the
midlevel-project's.  midlevel-project1 acts as both a parent and
aggregator to war-project and ear-project, which depend on
midlevel-project2 (and there are multiple modules with the same
structure as midlevel-project1).  Right now, I have POMs (oversimplified
and stripped of proprietary info) below.  I need to be able to navigate
to the master-project and build (which works fine).  I also need to be
able to navigate to midlevel-project1 and build just that.  However,
when I try to do the latter, it complains about the dependency
midlevel-project2.  Is there a way to do this, or is multi-module
building in maven an all-or-nothing proposition?

Thanks,
Dhruva

*** master-project ***
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.xyz</groupId>
  <artifactId>master-project</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>

  <modules>
    <module>midlevel-project1</module>
    <module>midlevel-project2</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.xyz</groupId>
        <artifactId>midlevel-project2</artifactId>
        <version>0.4-SNAPSHOT</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

*** midlevel-project1 ***
<project>
  <parent>
    <artifactId>master-project</artifactId>
    <groupId>com.xyz</groupId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../master-project/pom.xml</relativePath>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.xyz</groupId>
  <artifactId>midlevel-project1</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>

  <modules>
    <module>war-project</module>
    <module>ear-project</module>
  </modules>

  <dependencies>
    <dependency>
      <groupId>com.xyz</groupId>
      <artifactId>midlevel-project2</artifactId>
    </dependency>
  </dependencies>
</project>

*** midlevel-project2 ***
<project>
  <parent>
    <artifactId>master-project</artifactId>
    <groupId>com.xyz</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.xyz</groupId>
  <artifactId>master-project2</artifactId>
  <version>0.4-SNAPSHOT</version>
</project>

*** war-project ***
<project>
  <parent>
    <artifactId>midlevel-project1</artifactId>
    <groupId>com.xyz</groupId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>  
  <modelVersion>4.0.0</modelVersion>
  <version>1.0-SNAPSHOT</version>
  <artifactId>war-project</artifactId>
  <packaging>war</packaging>
</project>

*** ear-project ***
<project>
  <parent>
    <artifactId>midlevel-project1</artifactId>
    <groupId>com.xyz</groupId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <version>1.0-SNAPSHOT</version>
  <artifactId>ear-project</artifactId>
  <packaging>ear</packaging>
</project>

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

Reply via email to