• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • groovy-plugin
    • None
    • Windows 7 64 bit
      groovy-plugin version 1.25
      jenkins 1.594
      groovy-version 2.3.4

      I cant set script parameters and properties with spaces correctly.

      I have a step "Execute Groovy script" with the command:
      println System.getProperty("param")

      Double qoutes
      The script parameters: -Dparam="a b"
      The Properties: param="a b"

      Both print: null

      Single qoutes
      The script parameters: -Dparam='a b'
      prints: null

      The Properties: param='a b'
      prints: 'a b'
      The string contains the single qoutes

      My workaround is to use properties with single qoutes and remove them within the script.

          [JENKINS-28960] parameters with spaces dont work on windows

          pjdarton added a comment -

          It's not merely "can't use spaces".
          The plugin calls groovy's batch files, which get very confused with complex arguments.
          e.g. They mess up * characters.

          The workaround I used was to do away with arguments entirely and to put the argument data within my groovy script code itself - you can trust the groovy script, you just can't trust the argument handling between the Jenkins job configuration data and the groovy script to pass things unmodified. Otherwise you can't pass in an argument string containing quotes or wildcards.

          pjdarton added a comment - It's not merely "can't use spaces". The plugin calls groovy's batch files, which get very confused with complex arguments. e.g. They mess up * characters. The workaround I used was to do away with arguments entirely and to put the argument data within my groovy script code itself - you can trust the groovy script, you just can't trust the argument handling between the Jenkins job configuration data and the groovy script to pass things unmodified. Otherwise you can't pass in an argument string containing quotes or wildcards.

            vjuranek vjuranek
            stautz85 Sebastian
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: