[ http://jira.codehaus.org/browse/MNG-1775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=208601#action_208601 ]
Karel Vervaeke commented on MNG-1775: ------------------------------------- I just spent some quality time with my debugger. Here are some of my conclusions (in the order of conception) * it appears that the interpolation of ${whatever} is performed, but testing the profile activation happens *BEFORE* the interpolation. 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 where a profile tests for ${project.build.directory}/something and at the same time it modifies ${project.build.directory} (by declaring <build><directory>...</directory></build> * looking somewhat further into FileProfileActivator, I found that some interpolation is done on the <exists> and <missing> values but afaict only these are used for interpolation of environment variables and system properties * FileProfileActivator is using RegexpBasedInterpolator. My first idea would be to change the Activator interface so it takes a java.util.Properties with additional properties to doe interpolation on. "basedir" would be a property that's easy enough to add to this map. That's it for now, I'm off until wednesday next week - Will give a shot at providing a patch then. > 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: test.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