I've recently run into the same situation.  I think the reason why you
are not able to resolve the property value is that in order to do so,
the parent POM must be located (because that is where the property is
defined).  You can't refer to that property in the <parent> element.  If
you simply changed the <parent> element to use an explicit version
number, the parent pom would be located and loaded, the variable
resolved, and you could then use it in other parts of your child pom
(including defining the version number of your child artifact).  I'm
doing this now.

Now, you may be thinking the same thing I was thinking -- that this
means you cannot define the parent version number in ONE place (the
parent pom) and refer it via a property in all places in child poms.
This appears to be the case and I consider it a limitation of Maven.  It
would appear that if you update the parent pom version number, you are
forced to edit all the child poms to use that version number explicitly
-- it can't be simply in one place.

-- Eric

-----Original Message-----
From: Morgovsky, Alexander (US - Glen Mills)
[mailto:[EMAIL PROTECTED] 
Sent: Saturday, October 28, 2006 8:12 AM
To: [email protected]
Subject: Inherited property resolution

I have a parent project which defines a test_version property, and a
child project which attempts to this property, which is the version of
the application in this case.  However, when doing a build, the
test_version property of the parent element does not get resolved.  I
get this error.  May someone please help me with this scenario?  Thanks
in advance for your help.
[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: test
ArtifactId: test
Version: ${test_version}

Reason: Unable to download the artifact from any repository

  test:test:pom:${test_version}

[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot find parent:
test:test for projec
t: test_sub_a:test_sub_a:pom:${test_version}

Parent project test:

<project>
        <artifactId>test</artifactId>
        <groupId>test</groupId>
        <version>1.0.0</version>
        <modelVersion>4.0.0</modelVersion>
        <modules>
                <module>test_sub_a</module>
        </modules>
        <packaging>pom</packaging>
        <properties>
                <test_version>1.0.0</test_version>
        </properties>
</project>

Child project test_sub_a:

<?xml version="1.0" encoding="UTF-8"?>
<project>
        <artifactId>test_sub_a</artifactId>
        <groupId>test_sub_a</groupId>
        <version>${test_version}</version>
        <modelVersion>4.0.0</modelVersion>
        <parent>
                <groupId>test</groupId>
                <artifactId>test</artifactId>
                <version>${test_version}</version>
        </parent>
        <packaging>pom</packaging>
</project> 


This message (including any attachments) contains confidential
information intended for a specific individual and purpose, and is
protected by law.  If you are not the intended recipient, you should
delete this message. 


Any disclosure, copying, or distribution of this message, or the taking
of any action based on it, is strictly prohibited. [v.E.1]

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

Reply via email to