You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Denner <ma...@gmail.com> on 2006/09/04 18:32:38 UTC

Weird error with hierarchical projects

Hi,

I'm in the process of migrating a project from Maven 1 to Maven 2.0.4
and, although it all seems to be going well, I've hit a problem with
the hierarchy of pom.xml.

We have a project that is divided into two halves: a client side and a
manager side.  Each of these sides is further divided into
sub-projects which generate JARs, WARs and EARs.  Now, our directory
structure mirrors this so we have './client/interfaces' and
'./client/web' as 'client' side projects.  We have pom.xml files at
each level of the project so:

./pom.xml
  <project>
    <groupId>foo</groupId>
    <artifactId>big-project</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>
    <modules>
      <module>client</module>
      <module>manager</module>
    </modules>
  </project>

./client/pom.xml
  <project>
    <parent>
      <groupId>foo</groupId>
      <artifactId>big-project</artifactId>
      <version>1.0</version>
    </parent>
    <artifactId>big-project-client</artifactId>
    <packaging>pom</packaging>
    <modules>
      <module>interfaces</module>
      <module>web</module>
    </modules>
  </project>

./client/interfaces.pom.xml:
  <project>
    <parent>
      <groupId>foo</groupId>
      <artifactId>big-project-client</artifactId>
      <version>1.0</version>
    </parent>
    <artifactId>big-project-client-interfaces</artifactId>
    <packaging>jar</packaging>
  </project>

Now, if I execute 'mvn clean' at the root of this hierarchy I get what
I expect: it goes into the client project, then into the interfaces
(does the clean), back out and up into web (does the clean), and then
into the manager project .... and finally exits.

If I go into the 'client/interfaces' project directory and do 'mvn
clean' that too does what I expect: cleans the current project only.

But, if I go into the 'client' project and execute 'mvn clean' I get
an error reporting that it cannot find the parent pom.xml in the
repository.  I would have expected it to going into interfaces and
then into the web project, doing the clean each time.

Weirder than this is the fact that 'mvn -X clean' clearly states that:

[DEBUG] Searching for parent-POM: foo:big-project::1.0 of project:
foo:big-project-client:pom:null in relative path: ../pom.xml
[DEBUG] Using parent-POM from the project hierarchy at: '../pom.xml'
for project: foo:big-project-adapter:pom:null
[DEBUG] Retrieving parent-POM: foo:big-project::1.0 for project:
foo:big-project:pom:1.0 from the repository.

So it finds it and then tries to download it from the repository!?!!

Now, if I remove the 'modules' from './client/pom.xml' it doesn't
complain but doesn't do anything.

So my question is: is this a bug where you cannot execute maven
mid-project hierarchy like this, or is this something I've done wrong?

Matt

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