On Feb 6, 2007, at 1:58 PM, Graham Leggett wrote:

Hi all,

I've been trying to use profile activation based on OS to work around maven's lack of support for exposing the OS family (you can test against the current OS family, you just cannot find out what the current OS family is using ${maven.os.family} or some equivalent, or it least it seems that way from the users list).

<snip>

The following variation does detect MacosX (using family instead of name):

    <profile>
      <id>activate-mac</id>
      <properties>
        <os-platform>macosx</os-platform>
        <os-arch>${os.arch}</os-arch>
      </properties>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
    </profile>

<snip>

But, as soon as you try and detect Linux and MacosX side by side, Linux is detected on MacosX, instead of MacOSX:

    <profile>
      <id>activate-linux</id>
      <properties>
        <os-platform>linux</os-platform>
        <os-arch>${os.arch}</os-arch>
      </properties>
      <activation>
        <os>
          <familylinux</family>
        </os>


I've done some research on this myself. The code this is actually doing the checking is here is from plexus-utils. I believe the version that is being used is :

http://svn.plexus.codehaus.org/browse/plexus/tags/plexus-utils-1.1/ src/main/java/org/codehaus/plexus/util/Os.java?r=3008

It turns out there is no linux family, there is only a 'unix' family which includes Mac OS X (since the name ends with X)

The by name stuff does compare case sensitive with the lower cased version of os.name, so you must use the all lower cased version.

This has been fixed in the latest version of plexus-utils version 1.4

Will maven-2.0.5 use the 1.4 version or an earlier one.

To solve the problem for my self... I use <family>mac</family> and <name>linux<name> for the two profiles.

Hope that helps!

Matt Brozowski


________________________________________________________________________ ___
Matt Brozowski, OpenNMS Maintainer Main: +1 919 812 4984
The OpenNMS Group, Inc. Fax: +1 503 961 7746
Email: [EMAIL PROTECTED] URL: http://www.opennms.com


Reply via email to