Values for os.family in Maven profile activation condition

纵然是瞬间 提交于 2019-12-03 22:51:33

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.

OS family values:

dos
mac
netware
os/2
tandem
unix
windows
win9x
z/os
os/400
openvms

Other value you can get by run simple program:

public class SystemProperties {
    public static void main(String[] args) {
        System.out.println("Os name: " + System.getProperty("os.name"));
        System.out.println("Os arch: " + System.getProperty("os.arch"));
        System.out.println("Os version: " + System.getProperty("os.version"));
    }
}

A very useful Maven command for checking these OS properties on your machine:

mvn enforcer:display-info

Example output on a SunOS / Sparc host:

[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_34 normalized as: 1.6.0-34
[INFO] OS Info: Arch: sparc Family: unix Name: sunos Version: 5.8

Example output on a Linux host:

[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.7.0_85 normalized as: 1.7.0-85
[INFO] OS Info: Arch: amd64 Family: unix Name: linux Version: 2.6.32-504.23.4.el6.x86_64

it might worth asking from maven help:

mvn help:system | grep "os\."
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!