Hi,
class “Project” has a method “void artifacts(Closure configureClosure)”. This method executes the given closure against a delegate of type “ArtifactHandler”.
It is possible for example to write:
artifacts
{
archives(file(‘someFile’)) { }
}
“archives” is the name of a configuration added by the java plugin.
The above syntax suggests that there is a method “archives” in class “ArtifactHandler”. That is not the case. There are however multiple versions of a method “add” with suitable parameters. If the method “archives” cannot be found the method “methodMissing” should be called. However I have looked at the class DefaultArtifactHandler (its the only implementation i found). It does not overwrite “methodMissing”. So why can I write “archives(file(‘someFile’)) { }” in that closure?
I now the documentation tells me I can do it, but I’m looking for the technical explanation.
Thanks in advance!