You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Yan Huang <az...@gmail.com> on 2007/10/19 00:22:57 UTC

Activate Profile

Hello,

Is there a way to configure a profile to be activated only if another
profile is not active? Let's say I have profile1, profile2 and profie3. I
only want to activate profile1 when profile2 is not active. How can I
achieve it?

Thanks
Yan

Re: Activate Profile

Posted by OMax <om...@ukr.net>.
Can you do that by defining a property in your profile2 for example
profile2.activate and specify negative case activation in profile1
<property>!${profile.active}</profile>

Please try.

Oleksandr Maksymchuk,  http://omax.org.ua OMax 
-- 
View this message in context: http://www.nabble.com/Activate-Profile-tf4650098s177.html#a13444137
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Activate Profile

Posted by OMax <om...@ukr.net>.
OK, I thought it's a bug that default activated profile is not used when
another is specified explicitly.
Why would one use the default activated profile? I think not for the reasons
to run it when another profile is not active. What if I have to specify some
another profile to execute (p3) and want to run p3 if p1 is not activated?
-- 
View this message in context: http://www.nabble.com/Activate-Profile-tf4650098s177.html#a13450709
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Activate Profile

Posted by OMax <om...@ukr.net>.
Yes I can agree with this behavior although documentation was not exactly
clear about that that why I posted bug a month ago:

http://jira.codehaus.org/browse/MNG-3229

Now I agree that this is role of main build section not profile that
executes by default.
-- 
View this message in context: http://www.nabble.com/Activate-Profile-tf4650098s177.html#a13463375
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Activate Profile

Posted by Tim Kettler <ti...@udo.edu>.
OMax schrieb:
>> When I attempt to activate a different profile on the Maven command 
>> line, I _still_ get the activeByDefault profile, and not the one I wanted.
> 
> It's opposite of what I have, at least on 2.0.7. If I activate different
> profile it's taken into the account but not the default one.

That's the way it's intended to work and it really should work this way,
IMO.

> But I would wanted the default one to be activated always not only when there
> where no profiles specified (that is how I translate activate by default) -
> this is exactly your behavior :)

If you have somthing that should be configured or invoked always, it
simply does not belong into a profile, but in the default build section
(or wherever else it goes).

> Oleksandr Maksymchuk, 
> http://omax.org.ua OMax 

-Tim

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


Re: Activate Profile

Posted by OMax <om...@ukr.net>.
What I can say here...

I can send you my copy of maven and you send me your :)

Let's use our workarounds for now...

Oleksandr Maksymchuk,
http://omax.org.ua OMax 
-- 
View this message in context: http://www.nabble.com/Activate-Profile-tf4650098s177.html#a13472522
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Activate Profile

Posted by Morris Jones <mo...@whiteoaks.com>.
OMax wrote:
>> When I attempt to activate a different profile on the Maven command 
>> line, I _still_ get the activeByDefault profile, and not the one I wanted.
> 
> It's opposite of what I have, at least on 2.0.7. If I activate different
> profile it's taken into the account but not the default one. But I would
> wanted the default one to be activated always not only when there where no
> profiles specified (that is how I translate activate by default) - this is
> exactly your behavior :)

Wow ... in the earlier thread I had people confirming the behavior I 
identified, i.e., activeByDefault is always active, and I could not 
activate an alternative profile.

I'm also using 2.0.7.

I guess it's time to give up on this again and live with either changing 
the profile for each configuration change, or not having any default and 
always specifying it on the command line.

I just imply from the word "default" that it can be overridden.

Mojo
-- 
Morris Jones
Monrovia, CA
http://www.whiteoaks.com
Old Town Astronomers http://www.otastro.org

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


Re: Activate Profile

Posted by OMax <om...@ukr.net>.
> When I attempt to activate a different profile on the Maven command 
> line, I _still_ get the activeByDefault profile, and not the one I wanted.

It's opposite of what I have, at least on 2.0.7. If I activate different
profile it's taken into the account but not the default one. But I would
wanted the default one to be activated always not only when there where no
profiles specified (that is how I translate activate by default) - this is
exactly your behavior :)

Oleksandr Maksymchuk, 
http://omax.org.ua OMax 
-- 
View this message in context: http://www.nabble.com/Activate-Profile-tf4650098s177.html#a13462945
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Activate Profile

Posted by Morris Jones <mo...@whiteoaks.com>.
Jason van Zyl wrote:
> The activator that is used for this is the "activeByDefault"

[...]

> If no other profile is active then this profile will be used. As soon as 
> another profile is active, this profile is knocked out. To have a 
> profile always on you place it in the "activeProfiles" element in your 
> settings.xml.

If only it worked that way.  I just started a thread about this very 
problem.

When I attempt to activate a different profile on the Maven command 
line, I _still_ get the activeByDefault profile, and not the one I wanted.

And the output from help:active-profiles is really odd.

See my thread on the subject "How to override an activeByDefault profile?"

I'd given up trying to solve this problem months ago, and thought I'd 
try coming back to it.

Mojo
-- 
Morris Jones
Monrovia, CA
http://www.whiteoaks.com
Old Town Astronomers: http://www.otastro.org

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


Re: Activate Profile

Posted by Jason van Zyl <ja...@maven.org>.
On 18 Oct 07, at 3:22 PM 18 Oct 07, Yan Huang wrote:

> Hello,
>
> Is there a way to configure a profile to be activated only if another
> profile is not active? Let's say I have profile1, profile2 and  
> profie3. I
> only want to activate profile1 when profile2 is not active. How can I
> achieve it?
>

The activator that is used for this is the "activeByDefault"

<profile>
   <id>default</id>
   <activation>
     <activeByDefault>true</activeByDefault>
  </activation>
  ..
</profile>

If no other profile is active then this profile will be used. As soon  
as another profile is active, this profile is knocked out. To have a  
profile always on you place it in the "activeProfiles" element in your  
settings.xml.

> Thanks
> Yan

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------




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