You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Glen Mazza <gl...@gmail.com> on 2008/06/12 02:14:30 UTC

Does explicitly activating a profile deactivate activeByDefault profiles in parent POMs?

Hello, I created Mavenized web service build scripts[1] that work with either
the GlassFish Metro or Apache CXF web service stacks.  I was hoping that the
user can just enter -PMetro or -PCXF and the scripts would give them a
CXF-based or a Metro-based web service provider or SOAP client.

But I think I've detected either a Maven bug or an error in my thinking. 
The Maven Build Profile documentation[2] states that activeByDefault=true
profiles are deactivated if another profile within the same pom file is
explicitly activated:  "All profiles that are active by default are
automatically deactivated when a profile in the pom is activated on the
command line or through its activation config."

[1] shows three pom files, a parent pom and separate submodule poms for the
web service provider and SOAP client.  Within the parent POM and service POM
I have two profiles defined, "Metro" and "CXF", with CXF active by default
for both.  Here was what I was thinking:

1.)  If I'm in the service POM's directory and enter "mvn whatever -PMetro",
not only is the activeByDefault CXF profile in the service POM deactivated,
but also the CXF in the parent POM.  Furthermore, the parent POM's Metro
profile would be activated.

2.)  If I'm in the client POM's directory (the POM with no profiles
declared), and enter "mvn whatever -PMetro", again, the CXF profile in the
parent POM would be deactivated and the Metro one activated.

Am I wrong on both accounts here?  Does this activation/deactivation of
activeByDefault profiles only hold for the current POM in the directory I am
in--they will *not* carry over to parent POM's?  If I have to, I can change
the blog entry to instruct the user to manually move the activeByDefault in
the parent POM to the web service stack he/she is actually using, unless
someone can think of something better.

Thanks,
Glen

[1] http://www.jroller.com/gmazza/date/20080417#WFstep3
[2]
http://maven.apache.org/guides/introduction/introduction-to-profiles.html

-- 
View this message in context: http://www.nabble.com/Does-explicitly-activating-a-profile-deactivate-activeByDefault-profiles-in-parent-POMs--tp17790007p17790007.html
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: Does explicitly activating a profile deactivate activeByDefault profiles in parent POMs?

Posted by Glen Mazza <gl...@gmail.com>.
Thanks...Actually, running mvn help:active-profiles [-PMetro or -PCXF] from
the parent POM directory at least is showing that the profile cascades to
the child POMs (although it is not clear whether the profile value cascades
upwards towards the parent.)  

At any rate, I think I have more profound problems with the POMs I'm using,
namely, the parent POM should just have e dependencyManagement section
instead of actual dependency declarations, and then I can place the
precisely needed dependencies in both the client and service POMs, and
divide them by profile there (CXF and Metro have different dependencies.) 
More work needed...

Thanks,
Glen




Brian E Fox wrote:
> 
> I am pretty sure it should only affect the current pom. However, perhaps
> there's a subtle difference between using -P to explicitly activate a
> profile and using a property to activate (combined with -D)
> 
> -----Original Message-----
> From: Glen Mazza [mailto:glen.mazza@gmail.com] 
> Sent: Wednesday, June 11, 2008 8:15 PM
> To: users@maven.apache.org
> Subject: Does explicitly activating a profile deactivate activeByDefault
> profiles in parent POMs?
> 
> 
> Hello, I created Mavenized web service build scripts[1] that work with
> either
> the GlassFish Metro or Apache CXF web service stacks.  I was hoping that
> the
> user can just enter -PMetro or -PCXF and the scripts would give them a
> CXF-based or a Metro-based web service provider or SOAP client.
> 
> But I think I've detected either a Maven bug or an error in my thinking.
> 
> The Maven Build Profile documentation[2] states that
> activeByDefault=true
> profiles are deactivated if another profile within the same pom file is
> explicitly activated:  "All profiles that are active by default are
> automatically deactivated when a profile in the pom is activated on the
> command line or through its activation config."
> 
> [1] shows three pom files, a parent pom and separate submodule poms for
> the
> web service provider and SOAP client.  Within the parent POM and service
> POM
> I have two profiles defined, "Metro" and "CXF", with CXF active by
> default
> for both.  Here was what I was thinking:
> 
> 1.)  If I'm in the service POM's directory and enter "mvn whatever
> -PMetro",
> not only is the activeByDefault CXF profile in the service POM
> deactivated,
> but also the CXF in the parent POM.  Furthermore, the parent POM's Metro
> profile would be activated.
> 
> 2.)  If I'm in the client POM's directory (the POM with no profiles
> declared), and enter "mvn whatever -PMetro", again, the CXF profile in
> the
> parent POM would be deactivated and the Metro one activated.
> 
> Am I wrong on both accounts here?  Does this activation/deactivation of
> activeByDefault profiles only hold for the current POM in the directory
> I am
> in--they will *not* carry over to parent POM's?  If I have to, I can
> change
> the blog entry to instruct the user to manually move the activeByDefault
> in
> the parent POM to the web service stack he/she is actually using, unless
> someone can think of something better.
> 
> Thanks,
> Glen
> 
> [1] http://www.jroller.com/gmazza/date/20080417#WFstep3
> [2]
> http://maven.apache.org/guides/introduction/introduction-to-profiles.htm
> l
> 
> -- 
> View this message in context:
> http://www.nabble.com/Does-explicitly-activating-a-profile-deactivate-ac
> tiveByDefault-profiles-in-parent-POMs--tp17790007p17790007.html
> 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
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Does-explicitly-activating-a-profile-deactivate-activeByDefault-profiles-in-parent-POMs--tp17790007p17791934.html
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: Does explicitly activating a profile deactivate activeByDefault profiles in parent POMs?

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
I am pretty sure it should only affect the current pom. However, perhaps
there's a subtle difference between using -P to explicitly activate a
profile and using a property to activate (combined with -D)

-----Original Message-----
From: Glen Mazza [mailto:glen.mazza@gmail.com] 
Sent: Wednesday, June 11, 2008 8:15 PM
To: users@maven.apache.org
Subject: Does explicitly activating a profile deactivate activeByDefault
profiles in parent POMs?


Hello, I created Mavenized web service build scripts[1] that work with
either
the GlassFish Metro or Apache CXF web service stacks.  I was hoping that
the
user can just enter -PMetro or -PCXF and the scripts would give them a
CXF-based or a Metro-based web service provider or SOAP client.

But I think I've detected either a Maven bug or an error in my thinking.

The Maven Build Profile documentation[2] states that
activeByDefault=true
profiles are deactivated if another profile within the same pom file is
explicitly activated:  "All profiles that are active by default are
automatically deactivated when a profile in the pom is activated on the
command line or through its activation config."

[1] shows three pom files, a parent pom and separate submodule poms for
the
web service provider and SOAP client.  Within the parent POM and service
POM
I have two profiles defined, "Metro" and "CXF", with CXF active by
default
for both.  Here was what I was thinking:

1.)  If I'm in the service POM's directory and enter "mvn whatever
-PMetro",
not only is the activeByDefault CXF profile in the service POM
deactivated,
but also the CXF in the parent POM.  Furthermore, the parent POM's Metro
profile would be activated.

2.)  If I'm in the client POM's directory (the POM with no profiles
declared), and enter "mvn whatever -PMetro", again, the CXF profile in
the
parent POM would be deactivated and the Metro one activated.

Am I wrong on both accounts here?  Does this activation/deactivation of
activeByDefault profiles only hold for the current POM in the directory
I am
in--they will *not* carry over to parent POM's?  If I have to, I can
change
the blog entry to instruct the user to manually move the activeByDefault
in
the parent POM to the web service stack he/she is actually using, unless
someone can think of something better.

Thanks,
Glen

[1] http://www.jroller.com/gmazza/date/20080417#WFstep3
[2]
http://maven.apache.org/guides/introduction/introduction-to-profiles.htm
l

-- 
View this message in context:
http://www.nabble.com/Does-explicitly-activating-a-profile-deactivate-ac
tiveByDefault-profiles-in-parent-POMs--tp17790007p17790007.html
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


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