How Does Groovy Support Adding Configuration in Gradle Configuration Script Block -
in gradle documentation when use configurations
block in build.gradle file closure passed delegates configurationcontainer
object. truncated form of example usage given below:
configurations { //adding configuration: myconfiguration }
i used calls inside closure being method calls on delegated object, here myconfiguration
single word , know in groovy method no parameters must have parentheses can't method call. somehow putting single word in looks me should invalid groovy new configuration of myconfiguration
added delegated configurationcontainer
.
how working?
project.configurations(closure) calls configurationcontainer.configure(closure), creates , adds named items container, declared in closure. because configurationcontainer extends nameddomainobjectcontainer, every item added should have name. in provided code sample name declared, myconfiguration item created , added, default field values. in case 1 needs configure item (change properties), configuration follows:
configurations { myconfiguration { transitive = false } }
more info/insights https://gist.github.com/tlberglund/3132622.
Comments
Post a Comment