Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5726

Update OS Activation To Allow Wildcards In OS Version

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1.1, 3.2.3
    • 3.9.7, 4.0.0-alpha-13, 4.0.0
    • Profiles
    • None
    • RHEL/CentOs
    • Patch

    Description

      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:

          <profile>
            <id>linux-rhel5</id>
              <activation>
                <activeByDefault>false</activeByDefault>
                <os>
                  <family>unix</family>
                  <name>Linux</name>
                  <version>*el5*</version>
                </os>
              </activation>
              <properties>
                  .....
      

      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:

                  <version>^.*(el5).*</version>
      

      I've also kept the ! notation, so the following can also be used:

                  <version>!^.*(el5).*</version>
      

      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?

      Attachments

        Issue Links

          Activity

            People

              kwin Konrad Windszus
              andylehane@hotmail.com Andy Lehane
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: