You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Marc Rohlfs (JIRA)" <ji...@codehaus.org> on 2010/02/04 15:55:56 UTC

[jira] Commented: (MNG-1775) No property expansion in profile activation

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

Marc Rohlfs commented on MNG-1775:
----------------------------------

Hi Karel, just some comments:

{quote}
Without the basedir property it works, however, the test would not work when building a multi-module project:

myproject
test (module)

When running from 'myproject', the file myproject/pom.xml would be checked
When running from 'test', the file myproject/test/pom.xml would be checked.
{quote}
The {{basedir}} property always points to the directory of the POM that is currently processed, not depending if You initiate the build from a parent module. If You want to check the {{myproject/pom.xml}} in {{myproject/test/pom.xml}}, You should use another property (like e.g. {{multiproject.basedir}}) and define it like
{code:xml}
<multimodule.basedir>${basedir}<multimodule.basedir>
{code}
in the parent POM and
{code:xml}
<multimodule.basedir>${basedir}/..<multimodule.basedir>
{code}
in the 1st level submodules and so on ...
This means that it wouldn't help You to work on the expansion of just the {{basedir}} property. I didn't check the patch You attached today, but I wonder if it worked.

{quote}
One possible solution would go along these lines:
1. originalModel = cloneModel(model)
2. interpolate(model)
3. determine active profiles, add their properties to the list of properties for interpolation
4. interpolate(model) again.

But then you would have weird situations ...
{quote}
I'm totally with You on this, I'd really like to have a two-step interpolation just like You described it. But I also see undefined situation coming up. And I think that's the reason why (by now) they only consider the expansion of the {{basedir}} property for profile activations. I'd suggest to discuss this on the Maven Developers mailing list first, because otherwise Maven Comitters might just decline any patch You invent on this.

About the patch You attached: Was it really a patch for the trunk (respectively for Maven 3)? Somehow I think that it is for Maven 2 ({{maven-2/branches/maven-2.2.x}}). Did You read the page about [Creating and submitting a patch|http://maven.apache.org/guides/development/guide-m2-development.html#Creating_and_submitting_a_patch]?

Kind regards
   Marc

> No property expansion in profile activation
> -------------------------------------------
>
>                 Key: MNG-1775
>                 URL: http://jira.codehaus.org/browse/MNG-1775
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Inheritance and Interpolation
>    Affects Versions: 2.0, 2.0.1
>         Environment: Linux
>            Reporter: Eric Andresen
>             Fix For: 3.0-alpha-7
>
>         Attachments: basedir_in_activation.patch, test.zip, test2.zip
>
>
> I have a profile specified in the pom.xml of a project. It is inteded to be activated based on the presence or absence of a file, using the <file> profile activator.
> The profiles are simple:
>       <profile>
>           <id>metis</id>
>           <activation>
>               <file><missing>${basedir}/../build.properties</missing></file>
>           </activation>
>           <build>
>               <filters><filter>${basedir}/../build.properties.metis</filter></filters>
>           </build>
>       </profile>
>       <profile>
>           <id>dev</id>
>           <activation>
>               <file><exists>${basedir}/../build.properties</exists></file>
>           </activation>
>           <build>
>               <filters><filter>${basedir}/../build.properties</filter></filters>
>           </build>
>       </profile>
> The problem comes in with ${basedir} -- it isn't being expanded for purposes of evaluating the file. It's trying to look for a file named "${basedir}/../build.properties", rather than "/home/joe/projectX/projY/../build.properties"; as a result, the "missing" directive is always true, and the dev profile is never activated. When the filter path is evaluated, the ${basedir} property *is* evaluated, however.

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