I can get default and jdk to activate together, but not the os with them; given 
the following profiles.xml:

<?xml version="1.0"?>

<profilesXml
   xmlns="http://maven.apache.org/xsd/profiles-1.0.0";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://maven.apache.org/xsd/profiles-1.0.0.xsd";>

   <profiles>
       <profile>
           <id>jdk1.5</id>

           <activation>
               <activeByDefault>false</activeByDefault>

               <jdk>1.5</jdk>
           </activation>
       </profile>

       <profile>
           <id>unix</id>

           <activation>
               <activeByDefault>false</activeByDefault>

               <os>
                   <family>unix</family>
               </os>
           </activation>
       </profile>

       <profile>
           <id>default</id>

           <activation>
               <activeByDefault>true</activeByDefault>
           </activation>
           etc.

I get the following output:

$ mvn enforcer:display-info help:active-profiles
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'enforcer'.
[INFO] ------------------------------------------------------------------------
[INFO] Building People Locator
[INFO]    task-segment: [enforcer:display-info]
[INFO] ------------------------------------------------------------------------
[INFO] [enforcer:display-info]
[INFO] Maven Version: 2.0.10
[INFO] JDK Version: 1.5.0_17 normalized as: 1.5.0-17
[INFO] OS Info: Arch: i386 Family: unix Name: linux Version: 2.6.24-21-server
[INFO] ------------------------------------------------------------------------
[INFO] Building People Locator
[INFO]    task-segment: [help:active-profiles] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 'edu.berkeley:people_locator:war:1.1-SNAPSHOT':

The following profiles are active:

- jdk1.5 (source: profiles.xml)
- default (source: profiles.xml)

No matter what I use between the os tags it never activates (arch, family, 
name).


COURCY Michael wrote:
It seems to me that activation of profiles is exclusive, i.e., only one profile is activated at a time.

No you can cumulate profiles
<profiles>        
        <profile>
                <id>id1</id>
                <activation><activeByDefault>true</activeByDefault></activation>
        </profile>
        <profile>
                <id>id2</id>
                <activation><activeByDefault>true</activeByDefault></activation>
        </profile>
  </profiles>

Mvn help:active-profiles

The following profiles are active:
 - id1 (source: pom)
 - id2 (source: pom)
 - dev (source: settings.xml)
 - delphi (source: settings.xml)
 - delphi (source: settings.xml)




-----Message d'origine-----
De : TM [mailto:thorsten.moel...@unibas.ch] Envoyé : mercredi 18 mars 2009 12:08
À : users@maven.apache.org
Objet : Activation of multiple profiles at the same time


Hello,

I'm facing some behavior regarding activation of multiple profiles within a 
pom.xml, which is contrary to what I was expecting. Maybe someone can help.

I have a pom consisting of three profiles:

<profiles>
        <profile><!-- Set tools.jar for most SUN JDKs. -->
                <id>default</id>
                <activation>
                        <activeByDefault>true</activeByDefault>
                </activation>
                <properties>
                        <toolsJAR>${java.home}/../lib/tools.jar</toolsJAR>
                </properties>
        </profile>
        <profile><!-- Mac OSX Java JDK doesn't has separate tools.jar. -->
                <id>tools-jar-mac</id>
                <activation>
                        <activeByDefault>false</activeByDefault>
                        <os>
                                <family>Mac</family>
                        </os>
                </activation>
                <properties>
                        <toolsJAR>${java.home}/../Classes/classes.jar</toolsJAR>
                </properties>
        </profile>
        <!--
        Add external dependency to StAX API (JSR-173) and Woodstox (which is an
        implementation of JSR-173). Both are not part of JDK 1.5. Starting from
        JDK 1.6 the built-in implementation is used.
        -->
        <profile>
                <id>jdk1.5</id>
                <activation>
                        <activeByDefault>false</activeByDefault>
                        <jdk>1.5</jdk>
                </activation>
                <dependencies>
                        <dependency>
                                <groupId>org.codehaus.woodstox</groupId>
                                <artifactId>woodstox-core-asl</artifactId>
                                <version>4.0.3</version>
                        </dependency>
                </dependencies>
        </profile>
</profiles>

What I want to achieve is that for platforms other than Mac OS _and_  Java version 1.5.* the profiles 
"default" _and_ "jdk1.5" will be activated. For platforms other than Mac OS _and_ Java 1.6 only the 
profile "default" should be activated. Finally, for the Mac OS platform the profile "tools-jar-mac"
_and_ "jdk1.5" should be activated for Java 1.5; while only profile 
"tools-jar-mac" should be activated for Java 1.6.

It seems to me that activation of profiles is exclusive, i.e., only one profile is activated at a 
time. For instance, when using mvn help:active-profiles on a Linux machine with Java 1.5 SDK, I see 
only profile "jdk1.5" activated, but what I was expecting is that "default" 
would be activated as well. Is there any way to achieve automatic activation of multiple profiles 
apart from explicitly stating profiles via -P on the command line.

-- Thorsten
--
View this message in context: 
http://www.nabble.com/Activation-of-multiple-profiles-at-the-same-time-tp22576838p22576838.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


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


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

Reply via email to