[ https://issues.apache.org/jira/browse/MNG-5784?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christian Schulte closed MNG-5784. ---------------------------------- Resolution: Not A Problem Assignee: Christian Schulte The example is using an incorrect property name {{project.parent.name}}. There is no {{<name>}} element in the {{<parent>}} declaration. Only those elements can be referenced. > SO question regarding replacing name tag with ${project.parent.name} does not > work in multi module builds. > ---------------------------------------------------------------------------------------------------------- > > Key: MNG-5784 > URL: https://issues.apache.org/jira/browse/MNG-5784 > Project: Maven > Issue Type: Bug > Components: Inheritance and Interpolation > Reporter: Karl Heinz Marbaise > Assignee: Christian Schulte > Priority: Minor > > Based on the following stackoverflow question: > http://stackoverflow.com/questions/29013184/maven-support-for-property-substitution-in-project-name > The described behaviour looks wrong to me. > The question is: Is it bug? > Copied content from SO: > In a multi module project, I want to reuse the project name from the parent > pom as part of the project name for each module. The only info I have managed > to find says that property substitution is not allowed in > /project/(groupId|artifactId|version), which suggests that it is allowed in > /project/name. > I have tried setting /project/name to `${project.parent.name} - Some Module` > in the pom for a sub module, but it seems that this property is only > substituted selectively: sometimes the literal string `${project.parent.name} > - Some Module` is used, sometimes the substitution works. > In the reactor summary, for example, the literal string is used: > {code} > [INFO] > ------------------------------------------------------------------------ > [INFO] Reactor Summary: > [INFO] > [INFO] Glorious Parent .................................... SUCCESS [ > 0.016 s] > [INFO] ${project.parent.name} - Some Module ............... SUCCESS [ > 2.482 s] > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD SUCCESS > [INFO] > ------------------------------------------------------------------------ > {code} > Same thing for the archiver when creating a manifest file using > `<addDefaultSpecificationEntries>` or `<addDefaultImplementationEntries>`. > However, if I manually add manifest entries, the substitution happens: > {code} > <manifestEntries> > <Project-Name>${project.name}</Project-Name> > </manifestEntries> > {code} > Results in `Project-Name: Glorious Parent - Some Module` > Is there any way to know when or where the substitution will happen, or - > preferrably - to make it happen everywhere, all the time? > **Example pom.xml: (parent)** > {code} > <?xml version="1.0" encoding="UTF-8"?> > <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>dummy-group-id</groupId> > <artifactId>dummy-parent</artifactId> > <version>1.0</version> > <packaging>pom</packaging> > <name>Glorious Parent</name> > > <properties> > > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> > </properties> > > <modules> > <module>child</module> > </modules> > </project> > {code} > **Example child/pom.xml: (module)** > {code} > <?xml version="1.0" encoding="UTF-8"?> > <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>dummy-group-id</groupId> > <artifactId>dummy-parent</artifactId> > <version>1.0</version> > </parent> > > <artifactId>dummy-test-artifact</artifactId> > <name>${project.parent.name} - Some Module</name> > > <build> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-jar-plugin</artifactId> > <version>2.6</version> > <configuration> > <archive> > <manifest> > > <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> > > <addDefaultImplementationEntries>true</addDefaultImplementationEntries> > </manifest> > <manifestEntries> > > <Project-Name>${project.name}</Project-Name> > </manifestEntries> > </archive> > </configuration> > </plugin> > </plugins> > </build> > > </project> > {code} > **Resulting manifest:** > {code} > Manifest-Version: 1.0 > Implementation-Title: ${project.parent.name} - Some Module > Project-Name: Glorious Parent - Some Module > Implementation-Version: 1.0 > Archiver-Version: Plexus Archiver > Built-By: developer > Specification-Title: ${project.parent.name} - Some Module > Implementation-Vendor-Id: dummy-group-id > Created-By: Apache Maven 3.2.5 > Build-Jdk: 1.8.0_31 > Specification-Version: 1.0 > {code} > **File structure:** > myproject/ > pom.xml > child/ > pom.xml > **Maven version:** 3.2.5 -- This message was sent by Atlassian JIRA (v6.3.4#6332)