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

Maven script can break if "-f" path contains special characters

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.0
    • Fix Version/s: 3.6.1
    • Component/s: Command Line
    • Labels:
      None
    • Environment:
      Windows 10 with PowerShell

      Description

      Executing maven on Windows using the -f or --file parameter to specify an alternate POM file can break the script if the path contains special characters.
      It was originally discovered on a Windows Jenkins instance with working directory located under C:\Program Files (x86)\Jenkins......

      Example:

      mvn -f "folderWithClosing)Bracket/pomFolder"

      Command line output: "Bracket/pomFolder" kann syntaktisch an dieser Stelle nicht verarbeitet werden.

      Just for fun: Starting calc from maven script using -f

      mvn -f " ' & start calc"

      Command line output: POM file ' and a new calculator process

      The bug was introduced with commit https://github.com/apache/maven/commit/f8ab2a650f32d5d87126d341d9bbfccbf99fd0ca for issue MNG-5889.

      Workaround: Use maven 3.3.9 or below

      Possible fix: Escape %FILE_ARG% and %POM_DIR% with " in echo commands in maven.cmd (line 120 and 129).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                slachiewicz Sylwester Lachiewicz
                Reporter:
                etzelc Christoph Etzel
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m