You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Abhishekh Padmanbhan (JIRA)" <ji...@codehaus.org> on 2010/02/17 16:19:57 UTC
[jira] Issue Comment Edited: (MNG-2446) parent Pom properties not
resolved for module dependencies
[ http://jira.codehaus.org/browse/MNG-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=210446#action_210446 ]
Abhishekh Padmanbhan edited comment on MNG-2446 at 2/17/10 9:18 AM:
--------------------------------------------------------------------
I think I might have a workaround/solution to this problem using a profiles.xml (MAVEN 2.1.0) in the root project that holds the project current version as a property. This property then can be used as a value to the version in the parent tag definition in all its sub modules.
Find below the workaround that I use to propagate the project version variable as a property to all of the project submodule. By doing this I avoid having to redefine the project parent pom version in all its submodules.
*PROJECT STRUCTURE (all caps are modules)*
ROOT
- pom.xml
- profiles.xml
- WAR
-- pom.xml
- EJB
-- pom.xml
*ROOT/profiles.xml*
{noformat}
<profilesXml>
<profiles>
<profile>
<id>projectProfile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<currentVersion>1.0.1</currentVersion>
</properties>
</profile>
</profiles>
</profilesXml>
{noformat}
*ROOT/pom.xml*
{noformat}
<project>
<groupId>projGrp</groupId>
<artifactId>rootProjName</artifactId>
<version>${currentVersion}</version>
</project>
{noformat}
*ROOT/EJB/pom.xml*
{noformat}
<project>
<artifactId>ejbProjName</artifactId>
<packaging>ejb</packaging>
<parent>
<groupId>projGrp</groupId>
<artifactId>rootProjName</artifactId>
<version>${currentVersion}</version>
</parent>
</project>
{noformat}
I think this way the project version is a property just in one file profiles.xml in the ROOT project and will be the only file that changes when the version changes.
I have not tested this exhaustively but seems to work in principle.
was (Author: abhishekhp):
I think I might have a workaround/solution to this problem using a profiles.xml (MAVEN 2.1.0) in the root project that holds the project current version as a property. This property then can be used as a value to the version in the parent tag definition in all its sub modules.
Find below the workaround that I use to propagate the project version variable as a property to all of the project submodule. By doing this I avoid having to redefine the project parent pom version in all its submodules.
*PROJECT STRUCTURE (all caps are modules)*
ROOT
- pom.xml
- profiles.xml
- WAR
-- pom.xml
- EJB
-- pom.xml
*profiles.xml*
{noformat}
<profilesXml>
<profiles>
<profile>
<id>projectProfile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<currentVersion>1.0.1</currentVersion>
</properties>
</profile>
</profiles>
</profilesXml>
{noformat}
*ROOT/pom.xml*
{noformat}
<project>
<groupId>projGrp</groupId>
<artifactId>rootProjName</artifactId>
<version>${currentVersion}</version>
</project>
{noformat}
*ROOT/EJB/pom.xml*
{noformat}
<project>
<artifactId>ejbProjName</artifactId>
<packaging>ejb</packaging>
<parent>
<groupId>projGrp</groupId>
<artifactId>rootProjName</artifactId>
<version>${currentVersion}</version>
</parent>
</project>
{noformat}
I think this way the project version is a property just in one file profiles.xml in the ROOT project and will be the only file that changes when the version changes.
I have not tested this exhaustively but seems to work in principle.
> parent Pom properties not resolved for module dependencies
> -----------------------------------------------------------
>
> Key: MNG-2446
> URL: http://jira.codehaus.org/browse/MNG-2446
> Project: Maven 2 & 3
> Issue Type: Bug
> Components: Dependencies
> Affects Versions: 2.0.4
> Environment: WindowsXP/Linux - JDK 1.4 last version
> Reporter: Jeremie Poutrin
> Assignee: Brett Porter
> Priority: Minor
> Attachments: InstallMojo.quoteReplacement.patch, maven-version-problem.zip
>
>
> root-project --> root-pom.xml with <version>${my.version}</version>
> |------->proj1 <parent><version>${my.version}</version></parent>
> |------->proj2 <parent><version>${my.version}</version></parent>
> | |
> | |->proj1 dependency
> |------->proj3 <parent><version>${my.version}</version></parent>
> if I compile from the root-project directory, all compile fine.
> if I compile from the proj2 directory, maven2 resolve proj2-${my.version}
> resolve proj1-${my.version}
> but tries to resolve the parent version root-project-${my.version} but this is not resolved.
--
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