Tuesday, April 14, 2009

Groovy: No signature of method: java.lang.String.call()

Exception: groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types:

The first time I ran into this, took some time to figure out. Maybe because I haven't got used to this dynamic language.


def sendMail(mailhost, port, from, to) {
ant.mail(mailhost:"${mailhostname}", mailport:"${port}", subject:'Test Email') {
from( address:"${from}" )
to( address:"${to}" )
message(msg)
}
}


Code above will throw this exception, because groovy will use input parameter "from" and "to" to evaluate from, to function ant.mail closure.

Change to a different name.

No comments:

Post a Comment