You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stefano Nichele <st...@gmail.com> on 2008/05/31 16:48:23 UTC

selecting profile in the pom.xml file

Hi All,
in my setting.xml I have two profiles for two project categories. Is it 
possible to select the profile to use in the pom.xml file so that for 
any project there is no way to use the wrong profile ?

Thanks in advance
ste

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: selecting profile in the pom.xml file

Posted by Martin <mg...@hotmail.com>.
Hi Simon in your settings.xml define your <profile>then activate the 
predefined profile by placing the profile in <activeProfile>
e.g.<settings>
	<profiles>
		<profile>
	      <id>freeform-lutece</id>
	      <properties>
	        <freeform.additionalGoals>lutece:exploded,lutece:inplace,lutece:assembly,lutece:site-assembly
			</freeform.additionalGoals>
	        <freeform.additionalFolders>webapp</freeform.additionalFolders>
	      </properties>
	    </profile>
		...
	</profiles>
	<activeProfiles>
	    <activeProfile>freeform-lutece</activeProfile>
	</activeProfiles>
</settings>http://dev.lutece.paris.fr/wikilutece/index.php?title=The_plugin_maven2_%22netbeans-freeform%22Bon 
Chance,Martin----- Original Message ----- 
From: "simon" <si...@chello.at>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Saturday, May 31, 2008 12:32 PM
Subject: Re: selecting profile in the pom.xml file


>
> On Sat, 2008-05-31 at 18:20 +0200, Stefano Nichele wrote:
>> Hi Mick,
>> thanks for your comment, but maybe my question was not clear enough. It
>> seems that in the settings.xml, you comment the profile that you don't
>> want to use according to the project that you are building. My
>> requirement is a bit different.
>> In my settings.xml I have profileA and profileB. ProfileA is the active 
>> one.
>>
>> Now I would like that  project1 uses profileA and project2 uses profileB
>> but I don't want to change my settings.xml  anytime. I need something to
>> say in the pom file of the project2 that the profile to use is profileB.
>
> For profiles declared within a pom, I believe that the <property> values
> defined in the pom can be used in the activation section of the profile.
>
> But I don't know of any way for a pom to select a profile from an
> external settings file. The properties defined in a pom cannot be
> referenced from an external profile definition.
>
> Note that in general, stuff in settings.xml (including profiles) should
> be used as little as possible, as it makes builds unrepeatable (it
> controls the build, but is not under version control). If you can move
> your profile from settings.xml into the pom that would be the best
> solution..
>
> Regards,
> Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: selecting profile in the pom.xml file

Posted by simon <si...@chello.at>.
On Sat, 2008-05-31 at 18:20 +0200, Stefano Nichele wrote:
> Hi Mick,
> thanks for your comment, but maybe my question was not clear enough. It 
> seems that in the settings.xml, you comment the profile that you don't 
> want to use according to the project that you are building. My 
> requirement is a bit different.
> In my settings.xml I have profileA and profileB. ProfileA is the active one.
> 
> Now I would like that  project1 uses profileA and project2 uses profileB 
> but I don't want to change my settings.xml  anytime. I need something to 
> say in the pom file of the project2 that the profile to use is profileB.

For profiles declared within a pom, I believe that the <property> values
defined in the pom can be used in the activation section of the profile.

But I don't know of any way for a pom to select a profile from an
external settings file. The properties defined in a pom cannot be
referenced from an external profile definition.

Note that in general, stuff in settings.xml (including profiles) should
be used as little as possible, as it makes builds unrepeatable (it
controls the build, but is not under version control). If you can move
your profile from settings.xml into the pom that would be the best
solution..

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: selecting profile in the pom.xml file

Posted by Stefano Nichele <st...@gmail.com>.
Hi Mick,
thanks for your comment, but maybe my question was not clear enough. It 
seems that in the settings.xml, you comment the profile that you don't 
want to use according to the project that you are building. My 
requirement is a bit different.
In my settings.xml I have profileA and profileB. ProfileA is the active one.

Now I would like that  project1 uses profileA and project2 uses profileB 
but I don't want to change my settings.xml  anytime. I need something to 
say in the pom file of the project2 that the profile to use is profileB.

Ste

Mick Knutson wrote:
> Yes.
> I add this at the bottom of my settings.xml:
>
>     <activeProfiles>
>         <!--=======  Environment Specific
> =================================-->
>         <!--<activeProfile>local</activeProfile>-->
>         <activeProfile>local-baselogic</activeProfile>
>
>         <!--<activeProfile>dev</activeProfile>-->
>         <!--<activeProfile>prod</activeProfile>-->
>
>
>         <!--=======  Choose one of container
> ===============================-->
>         <activeProfile>tomcat5.5</activeProfile>
>     </activeProfiles>
>
>
>
> On Sat, May 31, 2008 at 7:48 AM, Stefano Nichele <st...@gmail.com>
> wrote:
>
>   
>> Hi All,
>> in my setting.xml I have two profiles for two project categories. Is it
>> possible to select the profile to use in the pom.xml file so that for any
>> project there is no way to use the wrong profile ?
>>
>> Thanks in advance
>> ste
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
>
>   


-- 
Stefano Nichele

Funambol Servers Tech Lead
funambol :: mobile open source :: http://www.funambol.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: selecting profile in the pom.xml file

Posted by Mick Knutson <mi...@gmail.com>.
Yes.
I add this at the bottom of my settings.xml:

    <activeProfiles>
        <!--=======  Environment Specific
=================================-->
        <!--<activeProfile>local</activeProfile>-->
        <activeProfile>local-baselogic</activeProfile>

        <!--<activeProfile>dev</activeProfile>-->
        <!--<activeProfile>prod</activeProfile>-->


        <!--=======  Choose one of container
===============================-->
        <activeProfile>tomcat5.5</activeProfile>
    </activeProfiles>



On Sat, May 31, 2008 at 7:48 AM, Stefano Nichele <st...@gmail.com>
wrote:

> Hi All,
> in my setting.xml I have two profiles for two project categories. Is it
> possible to select the profile to use in the pom.xml file so that for any
> project there is no way to use the wrong profile ?
>
> Thanks in advance
> ste
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Tahoe: http://tahoe.baselogic.com