You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Corbin <dc...@allureglobal.com> on 2007/05/08 20:43:15 UTC

Deactivating profiles

Twice this week for two seperate reasons, I've wanted to use profiles where it 
was active by default, but it would be possible to de-activate it based on 
property.

I don't see anyway to do this.  Am I missing something?

Thanks
David

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


Re: Deactivating profiles

Posted by James Abley <ja...@gmail.com>.
On 10/05/07, David Corbin <dc...@allureglobal.com> wrote:
> On Thursday 10 May 2007 08:52:04 Stephen Coy wrote:
> > Hi,
> >
> > There's a trick to this I discovered about six months ago. It is
> > possible to define a profile that is active when an env variable is
> > *not* defined:
> >
> > <profile>
> >             <activation>
> >                 <property>
> >                     <name>!myVar</name>
> >                 </property>
> >             </activation>
> > ...
> > </profile>
> >
>
> Beautiful!  Thanks.  That should be documented on the maven site.

+1. That was what I was missing too!

>
> ---------------------------------------------------------------------
> 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: Deactivating profiles

Posted by David Corbin <dc...@allureglobal.com>.
On Thursday 10 May 2007 08:52:04 Stephen Coy wrote:
> Hi,
>
> There's a trick to this I discovered about six months ago. It is
> possible to define a profile that is active when an env variable is
> *not* defined:
>
> <profile>
>             <activation>
>                 <property>
>                     <name>!myVar</name>
>                 </property>
>             </activation>
> ...
> </profile>
>

Beautiful!  Thanks.  That should be documented on the maven site.

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


Re: Deactivating profiles

Posted by Stephen Coy <st...@resolvesw.com>.
Hi,

There's a trick to this I discovered about six months ago. It is  
possible to define a profile that is active when an env variable is  
*not* defined:

<profile>
            <activation>
                <property>
                    <name>!myVar</name>
                </property>
            </activation>
...
</profile>

Deactivate the profile by defining the property.

For more information see < http://docs.codehaus.org/display/MAVENUSER/ 
Profiles>.

Steve C.

On 09/05/2007, at 4:43 AM, David Corbin wrote:

> Twice this week for two seperate reasons, I've wanted to use  
> profiles where it
> was active by default, but it would be possible to de-activate it  
> based on
> property.
>
> I don't see anyway to do this.  Am I missing something?
>
> Thanks
> David
>
> ---------------------------------------------------------------------
> 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: Deactivating profiles

Posted by David Corbin <dc...@allureglobal.com>.
On Wednesday 09 May 2007 11:48:00 John Casey wrote:
> It's a little hackish, but if you have a profile that's activeByDefault,
> and you want to disable it deliberately, then you can create an empty,
> dummy profile, and activate that. So:
>
> <profile>
>   <id>dummy</id>
> </profile>
>
> then:
>
> mvn -P dummy <goals>

Thanks.  Are profile exclusive then?  I thought that you activate multiple 
profiles (based on different conditions.


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


Re: Deactivating profiles

Posted by John Casey <ca...@gmail.com>.
It's a little hackish, but if you have a profile that's activeByDefault, and
you want to disable it deliberately, then you can create an empty, dummy
profile, and activate that. So:

<profile>
  <id>dummy</id>
</profile>

then:

mvn -P dummy <goals>

Good luck,

-john

On 5/9/07, James Abley <ja...@gmail.com> wrote:
>
> I have a situation like this as well.
>
> My use case is the maven release plugin and cargo. For day to day
> builds, I want to use cargo to deploy the latest version of a war file
> to my web container. During the release, the build falls over during
> the cargo undeploy step due to the incremented version number of the
> POM, which is part of the war file name.
>
> So during a release, I wanted to disable cargo.
>
> mvn release:prepare -Dcargo=false ...
>
> This was the closest I found:
>
> http://www.nabble.com/Skipping-cargo-tf2761726.html#a7702937
>
> A concrete example would be be handy! I've tried the below, but it
> doesn't work - the cargo plugin doesn't get called.
>
>     <profiles>
>         <profile>
>             <!--
>                 To disable the cargo plugin to undeploy and deploy to
> Tomcat,
>                 use -Dcargo=false, or not 'true' as part of the mvn
> command line.
>             -->
>             <activation>
>                 <property>
>                     <name>cargo</name>
>                     <value>true</value>
>                 </property>
>             </activation>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <groupId>org.codehaus.cargo</groupId>
>                         <artifactId>cargo-maven2-plugin</artifactId>
>                         <configuration>
>                             <deployer>
>                                 <deployables>
>                                     <deployable>
>                                         <artifactId>
>                                             ${pom.artifactId}
>                                         </artifactId>
>                                         <groupId>
>                                             ${pom.groupId}
>                                         </groupId>
>                                     </deployable>
>                                 </deployables>
>                             </deployer>
>                         </configuration>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>     </profiles>
>     <properties>
>         <!-- enable cargo profile by default -->
>         <cargo>true</cargo>
>     </properties>
>
> Cheers,
>
> James
>
> On 08/05/07, David Corbin <dc...@allureglobal.com> wrote:
> > Twice this week for two seperate reasons, I've wanted to use profiles
> where it
> > was active by default, but it would be possible to de-activate it based
> on
> > property.
> >
> > I don't see anyway to do this.  Am I missing something?
> >
> > Thanks
> > David
> >
> > ---------------------------------------------------------------------
> > 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
>
>


-- 
John Casey
---
Maven Developer (http://maven.apache.org)
---
Blog: http://www.ejlife.net/blogs/buildchimp

Re: Deactivating profiles

Posted by James Abley <ja...@gmail.com>.
I have a situation like this as well.

My use case is the maven release plugin and cargo. For day to day
builds, I want to use cargo to deploy the latest version of a war file
to my web container. During the release, the build falls over during
the cargo undeploy step due to the incremented version number of the
POM, which is part of the war file name.

So during a release, I wanted to disable cargo.

mvn release:prepare -Dcargo=false ...

This was the closest I found:

http://www.nabble.com/Skipping-cargo-tf2761726.html#a7702937

A concrete example would be be handy! I've tried the below, but it
doesn't work - the cargo plugin doesn't get called.

    <profiles>
        <profile>
            <!--
                To disable the cargo plugin to undeploy and deploy to Tomcat,
                use -Dcargo=false, or not 'true' as part of the mvn
command line.
            -->
            <activation>
                <property>
                    <name>cargo</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <configuration>
                            <deployer>
                                <deployables>
                                    <deployable>
                                        <artifactId>
                                            ${pom.artifactId}
                                        </artifactId>
                                        <groupId>
                                            ${pom.groupId}
                                        </groupId>
                                    </deployable>
                                </deployables>
                            </deployer>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <properties>
        <!-- enable cargo profile by default -->
        <cargo>true</cargo>
    </properties>

Cheers,

James

On 08/05/07, David Corbin <dc...@allureglobal.com> wrote:
> Twice this week for two seperate reasons, I've wanted to use profiles where it
> was active by default, but it would be possible to de-activate it based on
> property.
>
> I don't see anyway to do this.  Am I missing something?
>
> Thanks
> David
>
> ---------------------------------------------------------------------
> 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