${project.parent.name} expression returns empty. Add getName() accessor to 
org.apache.maven.model.Parent API
------------------------------------------------------------------------------------------------------------

                 Key: MNG-4130
                 URL: http://jira.codehaus.org/browse/MNG-4130
             Project: Maven 2
          Issue Type: Bug
          Components: POM
    Affects Versions: 2.1.0
            Reporter: Chris Beams
            Priority: Minor



h3. Setup

{code:title=parent pom}
<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.myco</groupId>
        <artifactId>foo-parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
        <name>Foo</name>
</project>
{code}

{code:title=child pom}
<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>
        <parent>
                <groupId>com.myco</groupId>
                <artifactId>foo</artifactId>
                <version>1.0.0-SNAPSHOT</version>
        </parent>
        <artifactId>foo-child</artifactId>
        <name>${project.parent.name}: Child</name>
</project>
{code}

h3. Expected results

{noformat}
cbe...@kaizen:~/Work/project/child>$ mvn clean
[INFO] Scanning for projects...
[INFO] 
----------------------------------------------------------------------------
[INFO] Building Foo: Child
[INFO]    task-segment: [clean]
[INFO] 
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Apr 10 09:29:47 PDT 2009
[INFO] Final Memory: 6M/16M
[INFO] ------------------------------------------------------------------------
{noformat}

Note that this expected behavior is no different than the way that 
{{${project.parent.artifactId}}} works today.  The absence of a {{name}} 
property is a gap in that expected support.

h3. Actual results

{noformat}
cbe...@kaizen:~/Work/project/child>$ mvn clean
[INFO] Scanning for projects...
[INFO] 
----------------------------------------------------------------------------
[INFO] Building ${project.parent.name}: Child
[INFO]    task-segment: [clean]
[INFO] 
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Apr 10 09:29:47 PDT 2009
[INFO] Final Memory: 6M/16M
[INFO] ------------------------------------------------------------------------
{noformat}

h3. Assumed cause

{{[org.apache.maven.model.Parent|http://maven.apache.org/ref/current/maven-model/apidocs/org/apache/maven/model/Parent.html]}}
 does not expose a {{getName()}}/{{setName()}} pair of property accessors.

h3. Proposed fix

Add {{setName()}}/{{getName()}} to the {{Parent}} API, and ensure that they are 
populated during the build/reactor lifecycle such that child poms can have 
access to them.

Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to