Maven 2 & 3

Profiles.xml does not pickup OS family

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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
  • Complexity:
    Intermediate
  • Testcase included:
    yes
  • Number of attachments :
    1

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.

Issue Links

Activity

Hide
Brett Porter added a comment -

confirmed - they work in pom.xml however

Show
Brett Porter added a comment - confirmed - they work in pom.xml however
Hide
Pawel Paprota added a comment -

Could it be this little oops in ProfilesConversionUtils.convertFromProfileXmlProfile?

Show
Pawel Paprota added a comment - Could it be this little oops in ProfilesConversionUtils.convertFromProfileXmlProfile?
Hide
Benjamin Bentmann added a comment -

Patch applied in r729785, r729786 and r729787, respectively. Thanks Pawel!

Note: While the fix has been ported to Maven 3.x, the corresponding IT shows this issue still unresolved. A first debugging session revealed that's because of a more general issue of the entire profiles.xml not being processed.

Show
Benjamin Bentmann added a comment - Patch applied in r729785, r729786 and r729787, respectively. Thanks Pawel! Note: While the fix has been ported to Maven 3.x, the corresponding IT shows this issue still unresolved. A first debugging session revealed that's because of a more general issue of the entire profiles.xml not being processed.
Hide
Benjamin Bentmann added a comment -

As per MNG-4060, the profiles.xml is not supported in Maven 3.x

Show
Benjamin Bentmann added a comment - As per MNG-4060, the profiles.xml is not supported in Maven 3.x

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: