Just forwarding this response back to the users list, so everyone has a chance to read.

-john

Begin forwarded message:

From: John Casey <[EMAIL PROTECTED]>
Date: May 24, 2007 9:55:28 AM EDT
To: "Maven Developers List" <[EMAIL PROTECTED]>
Subject: Re: Settings Variable expansion

System properties are basically the only thing available at the time that the settings.xml is read. Since profile definitions are read from the settings, it causes a sort of chicken-and-egg scenario to try variable expansion with variables defined in profiles.

Also, if we took a second round of processing, this time including properties from profiles, we could in turn activate more profiles (or deactivate some that had already donated new variables)...which seems like an ambiguous, recursive mess.

Also note that plugin configuration goes through a second round of variable expansion, using values from the current build state in addition to those used during initial POM and settings interpolation. Anything that isn't resolved through direct variable expansion in the settings or POM then has another chance at resolution here...just FWIW. That will not include Repository instances and so forth, which have already been constructed with their various value expressions...only direct plugin configuration.

Oh, and you also have the option of performing additional variable expansion steps inside your own plugin, using that RegexBasedInterpolator if you like...

HTH,

-john


On May 24, 2007, at 12:56 AM, Timothy Reilly wrote:

I am reposting this question to dev list based on a (very) vague
understanding of how it working now:

I see the settings runs through
org.codehaus.plexus.util.interpolation.RegexBasedInterpolator so I think the answer to my question is that only system properties are available
for variable expansion in the settings files? And properties from an
activated profile would not be?

Also, without really obsorbing the code yet... Would a second round of
processing be a valid enhancement request?
(In the second round I assume there is a different ValueSource which
would take properties defined by an activated profile?)


-----Original Message-----
From: Timothy Reilly
Sent: Tuesday, May 22, 2007 5:21 PM
To: users@maven.apache.org
Subject: Settings Variable expansion

Based on this information
http://maven.apache.org/settings.html
<http://maven.apache.org/settings.html>
<http://maven.apache.org/settings.html
<http://maven.apache.org/settings.html> > I thought that
variables and variable expansion would be available anywhere
in a POM _and_ settings files?
Is this not the case - is it only pom xml that does expansion?
<quot>
They come in five different styles, _all accessible from the
settings.xml_ </quot> Currently my settings.xml has:
<settings xmlns=http://maven.apache.org/POM/4.0.0
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd
<http://maven.apache.org/xsd/settings-1.0.0.xsd> "> <profiles>
<!-- desktop profile -->
<profile>
<id>windows</id>
<activation>
<activeByDefault>false</activeByDefault>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<environment>UNIT</environment>
</properties>
</profile>
<profile>
<id>test-resolution</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>my-unit</id>
<layout>default</layout>
<name>my-unit</name>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>daily</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>
http://myurl:18080/my/${environment}/release
<http://myurl:18080/my/${environment}/release>
</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>


But help:effective-settings shows the ${environment} isn't expanding.
<repository>
<releases>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>my-unit</id>
<name>my-unit</name>
<url>http://myurl:18080/my/${environment}/release</url>
</repository>

Am I doing something incorrectly?




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---
John Casey
Committer and PMC Member, Apache Maven
mail: jdcasey at commonjava dot org
blog: http://www.ejlife.net/blogs/john



---
John Casey
Committer and PMC Member, Apache Maven
mail: jdcasey at commonjava dot org
blog: http://www.ejlife.net/blogs/john


Reply via email to