Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Profiles

Profiles provide the if-else of the POM. It is basically aimed towards configuring your build depending on the properties. A couple of the usual properties used are the JDK, the OS ( Operating System ). Furthermore, Profiles can be activated depending on whether a particular file exists or not.

Generic Property Activation

You can activate a profile when a specific system property is set.  Note only properties set on the Maven command line can activate profiles.  Properties set in the POM, the parent POM, or other profiles have no effect.

To activate a profile when a certain property has a certain value (in this case myproperty=myvalue):

To activate a profile when a certain property exists (regardless of value):


JDK Activation


OS Activation

To configure the activation via the operating system, you can specify at least one out of four (4) things - name, family, architecture, and version.

The Profile OS Activation part looks like this

For the family, architecture, and version, this is checked by comparing these values against System.getProperties( "os.name" ), System.getProperties( "os.arch" ), System.getProperties( "os.version" ) respectively. Thus, the allowed values for these tags depends on what are allowed in those System properties.

However, for the family, there is a list of possible family values you can enter.

Family Value

Condition for Activation

windows

if OS name contains the word "windows"

os/2

if OS name contains the word "os/2"

netware

if OS name contains the word "netware"

dos

if OS family is not "netware", and its path separator is ";"

mac

if OS name contains the word "mac"

tandem

if OS name contains the word "nonstop_kernel"

unix

if OS family is not "openvms" and not "mac" which names does not end with "X", and its path separator is ":"

win9x

is OS family is "windows" and OS name contains "95", "98", "me", or "ce"

z/os

if OS name contains the word "z/os" or "os/390"

os/400

if OS name contains the word "os/400"

openvms

if OS name contains the word "openvms"

Warning

Icon

You may need to declare your os family, name, arch, and version all in small caps ( see MNG-2814 ).

File Activation 


Others

Negation

Prepend "!" on property name, os family, os name, os version and os arch to negate.

Meaning

gets executed when myproperty is not defined. And

gets evaluated as true when

Active by Default 

Set to true to activate  by default

  • No labels