Values for os.family in Maven profile activation condition

MaDa picture MaDa · Sep 26, 2013 · Viewed 20.9k times · Source

Maven allows to activate certain build profiles based on the operating system family it runs on, for example:

<profile>
    <activation>
        <os><family>Windows</family></os>
    </activation>
</profile>

There is a number of question around this: what are allowed values for os.family then? Are they case sensitive? Does Linux come across as Unix? Or unix? And so on.

Where can I find information about allowed values – or, at least, where does Maven take these values from? Environment variables?

Answer

Joe picture Joe · Sep 26, 2013

The values are defined in the plexus-utils project, in Os.java. You can see in isOs that the match is case-insensitive, that the value is taken from System.getProperty( "os.name" ) and that you should specify unix to match a Linux platform.