This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch feature/os-version-matching-in-profile-activation in repository https://gitbox.apache.org/repos/asf/maven-site.git
commit 3e87b5d82a508ceafdc876db26d64e452a848f06 Author: Konrad Windszus <k...@apache.org> AuthorDate: Fri Mar 8 14:43:02 2024 +0100 [MNG-5726] Describe regex matching for OS version profile activation Extend description in POM reference. --- .../guides/introduction/introduction-to-profiles.apt | 12 ++++++++++++ content/apt/pom.apt.vm | 18 +++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/content/apt/guides/introduction/introduction-to-profiles.apt b/content/apt/guides/introduction/introduction-to-profiles.apt index ebb0afdc..66dbe7b9 100644 --- a/content/apt/guides/introduction/introduction-to-profiles.apt +++ b/content/apt/guides/introduction/introduction-to-profiles.apt @@ -221,6 +221,18 @@ mvn groupId:artifactId:goal -P profile-1,profile-2,?profile-3 </profiles> +---+ + The values are interpreted as Strings and are matched against the {{{https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html}Java System properties}} + <<<os.name>>>, <<<os.arch>>>, <<<os.version>>> and the family being derived from those. + + Each value can be prefixed with <<<!>>> to negate the matching. + The values match if they are (not) equal to the actual String value. + All given OS conditions must match for the profile to be considered for activation. + + Since {{{https://issues.apache.org/jira/browse/MNG-5726}Maven 3.9.7}} the value for <<<version>>> may be prefixed with <<<regex:>>>. + In that case {{{https://docs.oracle.com/javase/tutorial/essential/regex/}regular pattern matching}} is applied for the version matching. + + The actual OS values which need to match the given values are emitted when executing <<<mvn --version>>>. + **** Property The profile below will be activated when the system property "debug" is specified diff --git a/content/apt/pom.apt.vm b/content/apt/pom.apt.vm index d4be9638..3d4300f4 100644 --- a/content/apt/pom.apt.vm +++ b/content/apt/pom.apt.vm @@ -2006,7 +2006,21 @@ scm:cvs:pserver:127.0.0.1:/cvs/root:my-project The value ranges match if the JDK version used for running Maven is between lower and upper bounds (either inclusive or exclusive). * <<os>>: - The <<<os>>> element can define some operating system specific properties shown above. See the maven-enforcer-plugins {{{https://maven.apache.org/enforcer/enforcer-rules/requireOS.html}RequireOS Rule}} for more details about OS values. + The <<<os>>> element can require some operating system specific properties having specific values. + Each value may start with <<<!>>> which means the condition is fulfilled if the value following does <not> equal the actual value, + otherwise the condition is fulfilled if the value equals the according system property (or derived value). + + * <<name>>, is matched against system property <<<os.name>>> + + * <<family>>, is matched against the family derived from the other <<os.*>> system properties + + * <<arch>>, is matched against system property <<<os.arch>>> + + * <<version>>, is matched against system property <<<os.version>>>. Since {{{https://issues.apache.org/jira/browse/MNG-5726}Maven 3.9.7}} + the value for <<<version>>> may be prefixed with <<<regex:>>>. In that case {{{https://docs.oracle.com/javase/tutorial/essential/regex/}regular pattern matching}} + is applied for the version matching. + + See the maven-enforcer-plugin's {{{/enforcer/enforcer-rules/requireOS.html}Require OS Rule}} for more details about OS values. * <<property>>: The <<<profile>>> will activate if Maven detects a system property or CLI user property (a value which can be dereferenced within the POM by <<<$\{name\}>>>) @@ -2030,6 +2044,8 @@ scm:cvs:pserver:127.0.0.1:/cvs/root:my-project mvn help:active-profiles ------- + Further information about profiles is available in {{{./guides/introduction/introduction-to-profiles.html}Introduction to Build Profiles}}. + ** {The BaseBuild Element Set} <(revisited)> As mentioned above, the reason for the two types of build elements reside in the fact that it does