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

Ant plugin does not correctly resolve and property resolving empty build parameter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • ant-plugin
    • None
    • Jenkins: 2.43
      Ant Plugin: 1.4

      OS: Mac/Linux/Windows - though problems most pronounced on windows

      If an ant build passes through a parameter referencing a "build parameter", the replacement will not occur if the build parameter is an empty string.

      e.g. if properties on Ant build step are:

      myprop=$buildVariable

      The resulting ant command line will look like:

      ant -Dmyprop=$buildVariable

      instead of

      ant -Dmyprop=

      The reason is that the EnvVars jenkins class, will remove properties when they are empty. This odd behaviour is also discussed in JENKINS-15146 ... it would seem that empty string is valid and only null should be removed.

      This issue is particularly tricky as things will mostly work as expected on Unix operating systems because the $buildVariable will be replaced by the shell with the build variable in the environment. If fails completely on Windows because no variable expansion occurs.

      Also note that the same behaviour is not seen by the gradle plugin, as does these replacements slightly differently (replacing build parameters without putting them into EnvVars).

      I'm preparing a pull request to resolve this.

            armfergom Armando Fernandez
            mattdoran Matt Doran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: