[ 
https://issues.apache.org/jira/browse/MNG-5726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17821301#comment-17821301
 ] 

ASF GitHub Bot commented on MNG-5726:
-------------------------------------

kwin commented on PR #1421:
URL: https://github.com/apache/maven/pull/1421#issuecomment-1966820871

   @gnodet Is there general support for matching globs built into Java (apart 
from Files NIO)? I haven't found anything and quick googling revealed 
https://stackoverflow.com/questions/1247772/is-there-an-equivalent-of-java-util-regex-for-glob-type-patterns.
 So I would say, regex is good enough for now.




> Update OS Activation To Allow Wildcards In OS Version
> -----------------------------------------------------
>
>                 Key: MNG-5726
>                 URL: https://issues.apache.org/jira/browse/MNG-5726
>             Project: Maven
>          Issue Type: New Feature
>          Components: Profiles
>    Affects Versions: 3.1.1, 3.2.3
>         Environment: RHEL/CentOs
>            Reporter: Andy Lehane
>            Assignee: Konrad Windszus
>            Priority: Minor
>         Attachments: maven-os-version-patch-3.2.3.zip
>
>
> I'm attempting to use maven to build a legacy project that requires different 
> dependecies based on the operating system version, i.e:
>  - version 1.0 of "a platform specific library" for Red Hat Linux 5 
>  - version 1.1 of "a platform specific library" for Red Hat Linux 6
>  - version 1.4a of "a platform specific library" for Windows and
>  - version 1.3b of (a platform specific library" for Solaris.
> I can configure my pom file to get activate specific profiles for RHEL, Win 
> and Solaris but cannot distinguish between Red Hat 5 and 6 unless I use the 
> full version string, which is of the form "2.6.32-504.1.3.el6.x86_64".
> As this Linux version will change whenever patch updates are installed, this 
> will make maintaining the pom/project akward.
> To solve this, it would be good to be able to specify wildcard's in the os 
> version tag. I have taken a look at the range checking (for example, as 
> applied to the JdkVersion), but don't think this method would be sufficient, 
> as the specific part of the Red Hat version number we require is buried over 
> half way into the version string (i.e. "el6" of the version 
> "2.6.32-504.1.3.el6.x86_64").
> It would be nice to be able to have something like:
> {code}
>     <profile>
>       <id>linux-rhel5</id>
>         <activation>
>           <activeByDefault>false</activeByDefault>
>           <os>
>             <family>unix</family>
>             <name>Linux</name>
>             <version>*el5*</version>
>           </os>
>         </activation>
>         <properties>
>             .....
> {code}
> I've taken a look at the OperatingSystemProfileActivator code and have 
> created a patch that will use ^ to signify that the text is a regular 
> expression, for example:
> {code}
>             <version>^.*(el5).*</version>
> {code}
> I've also kept the ! notation, so the following can also be used:
> {code}
>             <version>!^.*(el5).*</version>
> {code}
> The patch added contains a unit test for the OperatingSystemProfileActivator 
> in the maven-model-builder project (warning: it's a nasty test but I couldn't 
> find a nicer way of being able to reliably manuplate the OS Version).
> I've also patch the OperatingSystemProfileActivator class in the maven-compat 
> project but have not been able to write a unit test for that class.
> Can this updated be considered for implementation/inclusion please?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to