Vincent Massol said:
Ok I think I know...
Actually the message is printed in the console.
You see something in the page only if you print in the global scope because
this is what gets returned by script evaluation. Calling “println” in a class
doesn’t return anything in the evaluation and thus you don’t see anything.
That’s why the examples at
http://extensions.xwiki.org/xwiki/bin/view/Extension/Groovy+Macro work.
Right, makes sense. So looks like the best fix is to return the string and print it from
global (script) scope. This works:
{{groovy}}
class Callee {
def hello() {
return "hello, world"
}
}
c = new Callee()
println c.hello()
{{/groovy}}