You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Paul Benedict (JIRA)" <ji...@codehaus.org> on 2014/07/02 15:45:18 UTC

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

     [ https://jira.codehaus.org/browse/MNG-4130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated MNG-4130:
-------------------------------

    Fix Version/s:     (was: Issues to be reviewed for 3.x)

> ${project.parent.name} expression returns empty. Add getName() accessor to org.apache.maven.model.Parent API
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-4130
>                 URL: https://jira.codehaus.org/browse/MNG-4130
>             Project: Maven
>          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}
> cbeams@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}
> cbeams@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 was sent by Atlassian JIRA
(v6.1.6#6162)