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

Christian Schulte commented on MNG-5726:
----------------------------------------

Can you open a pull request on github or attach a real patch file (git 
format-patch) to this issue please? I would not want to use the {{^}} character 
to identify a regular expression since it is also a valid regular expression 
boundary matcher. So in my opinion the syntax needs to be changed a bit. Maybe 
sourrounding the expression in single quotes makes it a regular expression or 
something like this. Opinions?


> 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: Improvement
>          Components: Profiles
>    Affects Versions: 3.1.1, 3.2.3
>         Environment: RHEL/CentOs
>            Reporter: Andy Lehane
>            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
(v6.3.4#6332)

Reply via email to