[ 
http://jira.codehaus.org/browse/MNG-624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=210447#action_210447
 ] 

Abhishekh Padmanbhan commented on MNG-624:
------------------------------------------

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.

> automatic parent versioning
> ---------------------------
>
>                 Key: MNG-624
>                 URL: http://jira.codehaus.org/browse/MNG-624
>             Project: Maven 2 & 3
>          Issue Type: Improvement
>          Components: Inheritance and Interpolation
>            Reporter: Brett Porter
>            Assignee: Ralph Goers
>            Priority: Blocker
>             Fix For: 3.1
>
>         Attachments: MNG-624-maven-2.0.x-r507648.patch, MNG-624-tests.tar.gz
>
>   Original Estimate: 4 hours
>  Remaining Estimate: 4 hours
>
> (this may be bumped to 2.1 or even made WON't FIX as it is contentious - see 
> MNG-521)
> currently, you have to specify the parent version when extending which makes 
> a project stand alone very easily, but has the drawback of being a 
> maintainance problem when you start development on a new version. Tools can 
> help, but it would be nice not to have to rely on them.
> One alternative is to allow the parent version to be omitted, and when it is 
> it is assumed you want the latest. The parent is used from the reactor or the 
> universal source directory. IT may also be read from a LATEST in the 
> repository though this is contentious - it may be better to simply fail in 
> that environment and require builds be in a known checkout structure for 
> building individual projects.
> This also introduces the need for tool support to populate the version on 
> release and deployment for reproducibility.

-- 
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