Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33727

Invoke Ant - Build failed if parameters contain spaces due to changes in quotes since 1.653

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • ant-plugin, core
    • Jenkins greater than 1.652

      IStarting from Jenkins 1.653 with the same plugins versions we noticed that the ant command is created differently and it does not work with our configuration.

      Add build step Invoke Ant with the following values:

      Ant Version: ANT_1.9.4
      Targets: -lib D:\ANT_1.9.4\ANT_libs Alpha.i
      Build File: buildInstallers.xml
      Properties:
      iaPath=${InstallAnywhereLocation}
      iaOutputDir=$WORKSPACE
      iaMergeModulesDir=

      buildView=$WORKSPACE
      buildLogsPath=$WORKSPACE
      installersPath=$WORKSPACE

      1.652 - Command output
      cmd.exe /C '"D:\ANT_1.9.4\bin\ant.bat -file buildInstallers.xml -DiaOutputDir=D:\JENKINS-WS\Alpha\workspace "-DiaPath=C:\Program Files (x86)\InstallAnywhere 2015" -DbuildLogsPath=D:\JENKINS-WS\Alpha\workspace -DiaMergeModulesDir="" -DbuildView=D:\JENKINS-WS\Alpha\workspace -DinstallersPath=D:\JENKINS-WS\Alpha\workspace -lib D:\ANT_1.9.4\ANT_libs Alpha.i && exit %%ERRORLEVEL%%"'

      1.653 and 1.654 - Command output
      cmd.exe /C "D:\ANT_1.9.4\bin\ant.bat -file buildInstallers.xml -DiaOutputDir=D:\JENKINS-WS\Alpha\workspace '"-DiaPath=C:\Program Files (x86)\InstallAnywhere 2015"' -DbuildLogsPath=D:\JENKINS-WS\Alpha\workspace -DiaMergeModulesDir= -DbuildView=D:\JENKINS-WS\Alpha\workspace -DinstallersPath=D:\JENKINS-WS\Alpha\workspace -lib D:\ANT_1.9.4\ANT_libs Alpha.i && exit %%ERRORLEVEL%%"

      BUILD FAILED
      Target "D:\JENKINS-WS\Alpha\workspace" does not exist in the project "TNMS Installers".

          [JENKINS-33727] Invoke Ant - Build failed if parameters contain spaces due to changes in quotes since 1.653

          Hugo Reis created issue -
          Ben Apgar made changes -
          Link New: This issue is related to JENKINS-33712 [ JENKINS-33712 ]

          Ben Apgar added a comment -

          We are getting this too.

          The problem is related to parameters that contain spaces.

          Previous behavior:

          • Full command enclosed by single quotes and doublequotes.
          • Parameters containing spaces enclosed by double-quotes.

          Example:

          '"ant.bat -DPARAM1=hello "-DPARAM2=hello world" -DPARAM3=world"'
          

          Current behavior:

          • Full command enclosed by double quotes.
          • Parameters containing spaces enclosed by single-quotes and double-quotes.
          "ant.bat -DPARAM1=hello '"-DPARAM2=hello world"' -DPARAM3=world"
          

          Ben Apgar added a comment - We are getting this too. The problem is related to parameters that contain spaces. Previous behavior: Full command enclosed by single quotes and doublequotes. Parameters containing spaces enclosed by double-quotes. Example: ' "ant.bat -DPARAM1=hello " -DPARAM2=hello world " -DPARAM3=world" ' Current behavior: Full command enclosed by double quotes. Parameters containing spaces enclosed by single-quotes and double-quotes. "ant.bat -DPARAM1=hello '" -DPARAM2=hello world "' -DPARAM3=world"
          Ben Apgar made changes -
          Summary Original: Invoke Ant build step does not work since 1.653 New: Invoke Ant - Build failed if parameters contain spaces due to changes in quotes since 1.653

          Ben Apgar added a comment - - edited

          escoem I think this is related to the changes in ArgumentListBuilder for your fix for JENKINS-28790

          Ben Apgar added a comment - - edited escoem I think this is related to the changes in ArgumentListBuilder for your fix for JENKINS-28790
          Ben Apgar made changes -
          Link New: This issue is related to JENKINS-28790 [ JENKINS-28790 ]
          Emilio Escobar made changes -
          Assignee New: Emilio Escobar [ escoem ]

          Emilio Escobar added a comment - - edited

          Thanks for the mention benapgar I will check it asap

          Emilio Escobar added a comment - - edited Thanks for the mention benapgar I will check it asap

          Ant-plugin does a post-process so may be can fix there

          Emilio Escobar added a comment - Ant-plugin does a post-process so may be can fix there

          Daniel Beck added a comment -

          Besides fixing any obvious bugs, it could make sense to add an option to not convert build parameters into system properties. They can still be accessed from the environment, but this would cut down the crazy wrt. command line arguments.

          (I'm pretty sure Text Parameters, i.e. multiline strings, aren't handled well here at all either.)

          Daniel Beck added a comment - Besides fixing any obvious bugs, it could make sense to add an option to not convert build parameters into system properties. They can still be accessed from the environment, but this would cut down the crazy wrt. command line arguments. (I'm pretty sure Text Parameters, i.e. multiline strings, aren't handled well here at all either.)

            escoem Emilio Escobar
            hugo_reis Hugo Reis
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: