You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David <dn...@gmail.com> on 2008/09/19 16:58:47 UTC
Having trouble with setting a property in settings.xml and activating a profile in a pom based on that property
Hello All,
I'm trying to set a property in the settings.xml file and then have a
profile in the pom.xml file activate if that property is set. Right now I
don't care about the value, I just need it to be set. Currently I have the
following in my settings.xml file.
<profile>
<id>A</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<david>C:\temp</david>
</properties>
</profile>
In my pom.xml I have the following.
<profiles>
<profile>
<id>B</id>
<activation>
<property>
<name>david</name>
</property>
</activation>
...
<profiles>
I can see from running mvn help:active-profiles that profile A in the
settings.xml file is active but profile B is not. I can also use the David
property in other areas of the pom file. I'm I doing something wrong? I'm
using Maven-2.0.6 on Windows.
Thanks,
David
Re: Having trouble with setting a property in settings.xml and activating a profile in a pom based on that property
Posted by Stefan Hübner <st...@googlemail.com>.
David,
this gave me hard time too. After a while I realized, that profiles
can only be activated by *system* properties which is a different
beast than those properties one can define in a POM or the settings.
System properties are those which are provided to maven by the command
line parameter "-D".
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
explicitely uses the term "system property" when it comes to profile
activation by property values.
-Stefan
2008/9/19 David <dn...@gmail.com>:
> Hello All,
>
> I'm trying to set a property in the settings.xml file and then have a
> profile in the pom.xml file activate if that property is set. Right now I
> don't care about the value, I just need it to be set. Currently I have the
> following in my settings.xml file.
>
> <profile>
> <id>A</id>
> <activation>
> <activeByDefault>true</activeByDefault>
> </activation>
> <properties>
> <david>C:\temp</david>
> </properties>
> </profile>
>
> In my pom.xml I have the following.
>
> <profiles>
> <profile>
> <id>B</id>
> <activation>
> <property>
> <name>david</name>
> </property>
> </activation>
> ...
> <profiles>
>
> I can see from running mvn help:active-profiles that profile A in the
> settings.xml file is active but profile B is not. I can also use the David
> property in other areas of the pom file. I'm I doing something wrong? I'm
> using Maven-2.0.6 on Windows.
>
> Thanks,
>
> David
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org