Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3566

ConfigSlurper fails with nested closures in environments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.3
    • 1.6.4
    • groovy-jdk
    • None
    • Linux 32 bit

    Description

      ConfigSlurper fails to properly parse the config when closures are nested within an environments section.

      test {
        foo {
          bar = '1'
          baz = '2'
        }
      }
      
      environments {
        dev {
          test {
            foo {
              bar = '3'
            }
          }
        }
      }

      For environment "dev", the config ends up as " {test={foo=

      {bar=3}

      }}", completely ignoring the "baz" configuration that was set in the default section.

      It seems that the nested closure is causing default values to be ignored. See the "testEnvironmentProperties2" in the attached ConfigSlurperTest.groovy (or the patch).

      Attachments

        1. ConfigSlurperTest.groovy
          15 kB
          David Mack
        2. ConfigSlurperTest.patch
          0.8 kB
          David Mack

        Activity

          People

            blackdrag Jochen Theodorou
            mackd David Mack
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: