Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-3933

Profiles.xml does not pickup OS family

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.9, 2.1.0-M1
    • Fix Version/s: 2.0.11, 2.1.0
    • Component/s: Profiles
    • Labels:
      None
    • Environment:
      Ubuntu 8.0.4 64-bit [2.6.24-21-generic #1 SMP Tue Oct 21 23:09:30 UTC 2008 x86_64 GNU/Linux] and
      Windows XP sp2 32-bit

      Description

      When using profiles.xml and specifying an OS family activator such as :

      <os>
      <family>unix</family>
      </os>

      The OS family is not detected and hence the profile never activates. I have verified this through mvn help:active-profiles. I have tried this on Windows(XP sp2) as well as Linux (Ubuntu 8.0.4). The only way I can get the profiles to activate is via systems properties:

      <activation>
      <property>
      <name>unix-profile</name>
      </property>
      </activation>

      and then use something of the form: mvn clean test -Dunix-profile.

      I've created an example that depends on a specific version of Junit depending on the OS. Unix depends on 4.5 and Windows on 3.8.

      Here's my profiles.xml:

      <profilesXml
      xmlns="http://maven.apache.org/PROFILES/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
      <profiles>
      <profile>
      <id>unix</id>
      <activation>
      <os>
      <family>unix</family>
      </os>
      </activation>
      <properties>
      <junit.version>4.5</junit.version>
      </properties>
      </profile>
      <profile>
      <id>windows</id>
      <activation>
      <os>
      <family>windows</family>
      </os>
      </activation>
      <properties>
      <junit.version>3.8</junit.version>
      </properties>
      </profile>
      </profiles>
      </profilesXml>

      Here's my pom.xml:

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>au.maven.test</groupId>
      <artifactId>profiles-bug</artifactId>
      <version>1.0-SNAPSHOT</version>
      <dependencies>
      <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      </dependency>
      </dependencies>
      <build>
      <plugins>
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
      <source>1.5</source>
      <target>1.5</target>
      </configuration>
      </plugin>
      </plugins>
      </build>
      </project>

      The only way I can get the correct artefact to be used is via a system property.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bentmann Benjamin Bentmann
                Reporter:
                sanjivsahayam sanjiv sahayam
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: