Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-1826

hasProperty() does not work in allprojects and subprojects closures with command line or explicitly set earlier

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.0-milestone-3
    • Fix Version/s: None

      Description

      When setting a project property hasProperty() always returns false within an allprojects/subprojects block. getProperty() sees it just fine. Where is hasProperty() being delegated to? Explicitly calling it.hasProperty() works, but doesn't seem like it should be necessary.

      if (hasProperty('testProp'))

      { println 'The project sees it' }

      allprojects {
      // NOTE: Where is this going?
      if (hasProperty('testProp'))

      { println 'Allprojects sees it' }

      try

      { println 'Allprojects really sees it, value of: ' + property('testProp') }

      catch (MissingPropertyException mpe)

      { println 'not there' }

      }

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            merscwog Spencer Allain
            Votes:
            9 Vote for this issue
            Watchers:
            12 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: