Maven
  1. Maven
  2. MNG-3940

Interpolation of environment variables is not case-insensitive on Windows

    Details

    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      00:47  wsmoak  I can't get ${env.PATH} to be evaluated in the pom... but only on Windows. Any ideas?
      00:47  wsmoak  echo %PATH% produces the right stuff. and it works fine with Maven 2.0.9 on OS X or linux
      

        Issue Links

          Activity

          Hide
          Wendy Smoak added a comment -

          Thanks, Benjamin.

          I was testing this by adding <properties><mypath>$

          {env.PATH}</mypath></properties> to a pom and then running mvn help:effective-pom.

          On Linux and OS X, the effective pom shows all the directories in the PATH environment variable. On Windows, it remains literally ${env.PATH}

          .

          However, $

          {env.M2_HOME}

          is expanded on all three OSs, so it's not all environment variables on Windows.

          Show
          Wendy Smoak added a comment - Thanks, Benjamin. I was testing this by adding <properties><mypath>$ {env.PATH}</mypath></properties> to a pom and then running mvn help:effective-pom. On Linux and OS X, the effective pom shows all the directories in the PATH environment variable. On Windows, it remains literally ${env.PATH} . However, $ {env.M2_HOME} is expanded on all three OSs, so it's not all environment variables on Windows.
          Hide
          Benjamin Bentmann added a comment -

          Yep, it's only those env vars whose names are not natively all upper-case. For instance, the real name of the PATH var on WinXP is "Path".

          Show
          Benjamin Bentmann added a comment - Yep, it's only those env vars whose names are not natively all upper-case. For instance, the real name of the PATH var on WinXP is "Path".
          Hide
          Benjamin Bentmann added a comment -

          Fixed in r729060, r729061 and r729066, respectively.

          The "fix" is not perfect in the sense that the env var lookup during interpolation is still not case-insensitive on Windows, e.g. {{$

          {env.Path}

          }} is not recognized. Instead, the native env var names are normalized to upper-case, which should be good enough for the major use cases.

          Show
          Benjamin Bentmann added a comment - Fixed in r729060 , r729061 and r729066 , respectively. The "fix" is not perfect in the sense that the env var lookup during interpolation is still not case-insensitive on Windows, e.g. {{$ {env.Path} }} is not recognized. Instead, the native env var names are normalized to upper-case, which should be good enough for the major use cases.
          Hide
          Paul Benedict added a comment -

          You could use a TreeMap with a String#CASE_INSENSITIVE_ORDER Comparator too.

          Show
          Paul Benedict added a comment - You could use a TreeMap with a String#CASE_INSENSITIVE_ORDER Comparator too.
          Hide
          Benjamin Bentmann added a comment -

          The problem is not finding a data structure to do case-insensitive lookups, the problem is to integrate that into the existing code. For instance, the env vars are end up in the same Properties instance as used for system/execution properties...

          Show
          Benjamin Bentmann added a comment - The problem is not finding a data structure to do case-insensitive lookups, the problem is to integrate that into the existing code. For instance, the env vars are end up in the same Properties instance as used for system/execution properties...

            People

            • Assignee:
              Benjamin Bentmann
              Reporter:
              Benjamin Bentmann
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: