You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Paul Smith <ps...@aconex.com> on 2007/06/06 01:56:28 UTC

Profile activation hierarchy question

mvn 2.0.4

I'm sure this is plainly my misunderstanding or something I'm doing  
wrong, but I have the following setup (see below).  I'm trying to  
configure it such that by default, the local settings.xml gets used  
by default, unless you specify the -P setting to use one specified in  
the pom.xml.

I'd like it such that:

mvn package

builds the native one based on the activeProfile defined in  
settings.xml, BUT if I do this:

mvn-Pfrontend_au_prod package

It ignores the active profile in settings.xml, and uses the one  
specified on the command line:

Using mvn help:active-profiles shows that it looks like it might work:

mvn help:active-profiles
....
The following profiles are active:

- frontend-au (source: settings.xml)


--------------
mvn -Pfrontend_au_prod help:active-profiles
..

The following profiles are active:

- frontend_au_prod (source: pom)
- frontend-au (source: settings.xml)

I thought the pom.xml one was supposed to take precedence.. ?

I'm extremely new to Maven, so this just may be a misunderstanding.   
Any help appreciated.

[MY SETUP]

settings.xml:
<settings>
...
		<profile>
			<id>frontend-au</id>
			<properties>
				<frontend>au</frontend>
				<frontend.environment>devunix</frontend.environment>
			</properties>
		</profile>
	</profiles>
	<activeProfiles>
		<activeProfile>frontend-au</activeProfile>
	</activeProfiles>
</settings>

in my pom.xml:
..	
	<profiles>
	  <profile>
	    <id>frontend_au_prod</id>
			<properties>
				<frontend>au</frontend>
				<frontend.environment>prod</frontend.environment>
			</properties>
	  </profile>
	  <profile>
	    <id>frontend_uk_prod</id>
			<properties>
				<frontend>uk</frontend>
				<frontend.environment>prod</frontend.environment>
			</properties>
	  </profile>
	</profiles>
...


Paul Smith
Core Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: psmith@aconex.com  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to  
copyright or other applicable law. No confidentiality or privilege is  
lost by an erroneous transmission. If you have received this e-mail  
in error, please let us know by reply e-mail and delete or destroy  
this mail and all copies. If you are not the intended recipient of  
this message you must not disseminate, copy or take any action in  
reliance on it. The sender takes no responsibility for the effect of  
this message upon the recipient's computer system.




Re: Profile activation hierarchy question

Posted by Paul Smith <ps...@aconex.com>.
and to be clear (sorry), the build still completes ok, but the  
resulting filtering is using the one derived from settings.xml, and  
not the explicit profile asked for on the command line..

Paul
On 06/06/2007, at 9:56 AM, Paul Smith wrote:

> mvn 2.0.4
>
> I'm sure this is plainly my misunderstanding or something I'm doing  
> wrong, but I have the following setup (see below).  I'm trying to  
> configure it such that by default, the local settings.xml gets used  
> by default, unless you specify the -P setting to use one specified  
> in the pom.xml.
>
> I'd like it such that:
>
> mvn package
>
> builds the native one based on the activeProfile defined in  
> settings.xml, BUT if I do this:
>
> mvn-Pfrontend_au_prod package
>
> It ignores the active profile in settings.xml, and uses the one  
> specified on the command line:
>
> Using mvn help:active-profiles shows that it looks like it might work:
>
> mvn help:active-profiles
> ....
> The following profiles are active:
>
> - frontend-au (source: settings.xml)
>
>
> --------------
> mvn -Pfrontend_au_prod help:active-profiles
> ..
>
> The following profiles are active:
>
> - frontend_au_prod (source: pom)
> - frontend-au (source: settings.xml)
>
> I thought the pom.xml one was supposed to take precedence.. ?
>
> I'm extremely new to Maven, so this just may be a  
> misunderstanding.  Any help appreciated.
>
> [MY SETUP]
>
> settings.xml:
> <settings>
> ...
> 		<profile>
> 			<id>frontend-au</id>
> 			<properties>
> 				<frontend>au</frontend>
> 				<frontend.environment>devunix</frontend.environment>
> 			</properties>
> 		</profile>
> 	</profiles>
> 	<activeProfiles>
> 		<activeProfile>frontend-au</activeProfile>
> 	</activeProfiles>
> </settings>
>
> in my pom.xml:
> ..	
> 	<profiles>
> 	  <profile>
> 	    <id>frontend_au_prod</id>
> 			<properties>
> 				<frontend>au</frontend>
> 				<frontend.environment>prod</frontend.environment>
> 			</properties>
> 	  </profile>
> 	  <profile>
> 	    <id>frontend_uk_prod</id>
> 			<properties>
> 				<frontend>uk</frontend>
> 				<frontend.environment>prod</frontend.environment>
> 			</properties>
> 	  </profile>
> 	</profiles>
> ...
>
>
> Paul Smith
> Core Engineering Manager
>
> Aconex
> The easy way to save time and money on your project
>
> 696 Bourke Street, Melbourne,
> VIC 3000, Australia
> Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
> Email: psmith@aconex.com  www.aconex.com
>
> This email and any attachments are intended solely for the  
> addressee. The contents may be privileged, confidential and/or  
> subject to copyright or other applicable law. No confidentiality or  
> privilege is lost by an erroneous transmission. If you have  
> received this e-mail in error, please let us know by reply e-mail  
> and delete or destroy this mail and all copies. If you are not the  
> intended recipient of this message you must not disseminate, copy  
> or take any action in reliance on it. The sender takes no  
> responsibility for the effect of this message upon the recipient's  
> computer system.
>
>
>

Paul Smith
Core Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: psmith@aconex.com  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to  
copyright or other applicable law. No confidentiality or privilege is  
lost by an erroneous transmission. If you have received this e-mail  
in error, please let us know by reply e-mail and delete or destroy  
this mail and all copies. If you are not the intended recipient of  
this message you must not disseminate, copy or take any action in  
reliance on it. The sender takes no responsibility for the effect of  
this message upon the recipient's computer system.