On 13-08-08 03:40 PM, Robert Scholte wrote:
Ths is a good example for "activeByDefault" as described at http://maven.apache.org/ref/3.1.0/maven-model/maven.html#class_activation

"If set to true, this profile will be active unless another profile in this pom is activated using the command line -P option or by one of that profile's activators.
Default value is: false."

Robert

Op Thu, 08 Aug 2013 23:35:58 +0200 schreef Curtis Rueden <[email protected]>:

Hi Dave,

I want to activate a profile (profileA) at all times unless the user
specifically requests profile B on the command line

I didn't look at the Maven source code, but I am guessing all profile
activations are evaluated before any activations actually take place? That
would an intuitive way to code it, anyway.

As a workaround, you could do:

                <profile>
                        <id>recreateTestDbON</id>
                        <activation>
                                <property>
<name>recreateTestDb</name>
                                </property>
                        </activation>
                        ...
                </profile>

                <profile>
                        <id>recreateTestDbOFF</id>
                        <activation>
                                <property>
<name>!recreateTestDb</name>
                                </property>
                        </activation>
                        ...
                </profile>

And have your users enable the feature using:

     mvn -DrecreateTestDb

Regards,
Curtis


On Thu, Aug 8, 2013 at 4:13 PM, laredotornado-3 <[email protected]>wrote:

Hi,

I'm using Maven 3.0.3.  I want to activate a profile (profileA) at all
times
unless the user specifically requests profile B on the command line (e.g.
"-P profileB").  However, right now both profiles are active when I run

        mvn clean install -P profileB

and I can't figure out why.  Here's the relevant section from my parent
pom.xml <profiles> section:

                <profile>
                        <id>profileB</id>
                        <properties>
<recreateTestDb>true</recreateTestDb>
                        ...
                        </properties>
                </profile>

                <profile>
                        <id>profileA</id>
                        <activation>
                                <property>
<name>!recreateTestDb</name>
                                </property>
                        </activation>
                        <properties>
                               ...
                        </properties>
                </profile>

Any suggestions how to configure the profiles to get the desired behavior?
Thanks, - Dave



--
View this message in context:
http://maven.40175.n5.nabble.com/How-do-I-de-activate-a-profile-if-another-profile-is-specified-tp5767107.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Besides the usual concrete implementation in maven syntax, you could actually do something like:

mkdir profile(x)
mv profile(x-1) profile(x)
mkdir profile(x+1)            # profile(x+1) is in the top-level directory

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to