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

Ralph Goers commented on MNG-624:
---------------------------------

I've committed a fix for MNG-624 onto branch maven-2.1.x-MNG-624 so you all can 
test it. Here's what I've done:

I'm only trying to resolve the parent version. I could try to resolve the 
parent groupId and artifactId but I just couldn't think of a reason why they 
wouldn't be specified.

The version is obtained by
1. Resolving any variables provided via system properties (variables from 
parents won't be found since the parent isn't known.
2. Looking in the file cache for the resolved parent project using the relative 
location as the key.
3. Looking for the parent at the relative path on disk.
    a. The target directory at the relative path is inspected for a modified 
pom.
    b. The project at the relative path is used.
If at the end of this a resolved parent version is not located throw an 
Exception. Do not try to recurse to further parents.

You'll notice the comment about looking for the modified pom in the target 
directory. As part of this fix the parent version, and the project's 
artifactId, groupId and version are all interpolated. If any of those fields 
were missing or had variables in them in the original pom then the pom is 
modified and written to the target directory. Thus, any pom that is installed 
or deployed will always have these fields resolved. 

In looking through the plugins it looked to me that the Eclipse and Invoker 
plugins are trying to locate the base directory by calling 
project.getFile().getParentFile(). These  will need to be changed to 
project.getBasedir() since the location of the pom might now be in a different 
place and project.getFile().getParentFile() might return the target directory 
instead of the base directory.

Maven 2.1 will require Java 5.

Please test and provide feedback.

> automatic parent versioning
> ---------------------------
>
>                 Key: MNG-624
>                 URL: http://jira.codehaus.org/browse/MNG-624
>             Project: Maven 2
>          Issue Type: Improvement
>          Components: Inheritance and Interpolation
>            Reporter: Brett Porter
>            Assignee: Ralph Goers
>            Priority: Blocker
>             Fix For: 3.0
>
>         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