Path normalization during inheritance prohibits usage of properties
-------------------------------------------------------------------

                 Key: MNG-3315
                 URL: http://jira.codehaus.org/browse/MNG-3315
             Project: Maven 2
          Issue Type: Bug
          Components: Inheritance and Interpolation
    Affects Versions: 2.0.8
            Reporter: Benjamin Bentmann


Assume a multi-module scenario with the following (non-standard) directory 
layout:
  project/
    project-parent/
    project-module-1/
    project-module-2/
That is, the parent POM is placed in a sibling directory rather than the parent 
directory of the module projects such that the "module path adjustment" is 
"../" when inheriting paths/URLs from the project-parent.

Now, consider the following POM snippet for the site distribution (or any other 
element where Maven adjusts paths for sub modules):
{code:xml}
  <site>
    <id>website</id>
    <url>dav:http://www.company.org/project</url>
  </site>
{code}
All fine so far, but this slightly modified snippet does not work any more:
{code:xml}
  <properties>
    <site.url>dav:http://www.company.org/project</site.url>
  </properties>
  ...
  <site>
    <id>website</id>
    <url>${site.url}</url>
  </site>
{code}

Just replacing the string by a property produces a bad URL for any sub project. 
This problems originates from DefaultModelInheritanceAssembler.resolvePath() 
that "normalizes" a string like "${site.url}/../project-module-1" to 
"project-module-1".

While the usage of the property is not mandatory, I nevertheless think the 
moral from this subtle issue should be not  to do any path normalization until 
all properties have been interpolated, i.e.:
- inheritance ( URL = "${site.url}/../project-module-1" )
- interpolation ( URL = 
"dav:http://www.company.org/project/../project-module-1"; )
- path/URL normalization ( URL = "dav:http://www.company.org/project-module-1"; )

Otherwise, Maven calls another weird pitfall its own.

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