ext and code block's meaning in the gradle file
gradle, groovy
Solution
`ext` is shorthand for `project.ext`, and is used to define extra properties for the `project` object. (It's also possible to define extra properties for many other objects.) When reading an extra property, the `ext.` is omitted (e.g. `println project.springVersion` or `println springVersion`). The same works from within methods. It does not make sense to declare a method named `ext`.
Problem
``` ext { springVersion = "3.1.0.RELEASE" emailNotification = "build@master.org" } ``` Above code is the snippet of build.gradle I understand that call ext method with { } closure parameter. it's right? So I think gradle is accessing springVersion and emailNotification. I'm gonna verify my assumption with below code ``` def ext(data) { println data.springVersion } ext { springVersion = "3.1.0.RELEASE" emailNotification = "build@master.org" } ``` but run that code below Error occured. ``` groovy.lang.MissingPropertyException: No such property: springVersion for class: Test ``` do you explain ext and code block specifically?