I see what you are trying to do... but why? If you do not define a child
project's version, it automatically inherits from its parent. Just take
<version>${main.version}</version> out.

On 11/21/06, Los Morales <[EMAIL PROTECTED]> wrote:

Hi,

I'm a bit frustrated on how Maven cycles through its
dependency.  Currently
I have a project consisting of multiple sub projects—2 levels
deep.  Here's
a hierarchy:

-->main
   --> sub1
      --> sub1sub1
      --> sub1sub2
   --> sub2

The main project has a POM looking like this:

<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.project.main</groupId>
    <artifactId>main</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Main Project</name>
    <url>http://maven.apache.org</url>
    <packaging>pom</packaging>
    <properties>
        <main.version>1.0-SNAPSHOT</main.version>
    </properties>
    <modules>
        <module>sub1</module>
        <module>sub2</module>
    </modules>
...
</project>


Now say my sub2 project looks like this:

<project>
    <parent>
        <artifactId>main</artifactId>
        <groupId>com.project.main</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.project.main.core</groupId>
    <artifactId>main-core-api</artifactId>
    <name>Main Core API</name>
    <version>${main.version}</version>
    <packaging>jar</packaging>
</project>

Sub project 1 and its repective subprojects are similar.  Now, from my
root
project (main), I run any mvn command, I get the following error:

###################################
[INFO] Error building POM (may not be this project's POM).

Project ID: com.project.main.sub1.sub2:main-sub1-sub2:jar:${main.version}

Reason: Cannot find parent: com.project.main.sub1:main-sub1 for project:
com.project.main.sub1.sub2:main-sub1-sub2:jar:${main.version}
####################################


So I go to my sub2 project and run any mvn command, I get the same error.
Looks like its not able to figure out the runtime value of {main.version}.
Hence I can not continue with any build process.  Any help would be
appreciated.  Thanks in advance.

-los

_________________________________________________________________
Fixing up the home? Live Search can help

http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmemailtaglinenov06&FORM=WLMTAG


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




--
Eric Redmond
http://codehaus.org/~eredmond

Reply via email to