How to use groovy script with nuxeo shell ?

Hi i'm trying to use a groovy script with the nuxeo shell but everytime I launch the command “script test.groovy” in the remote namespaces, connected as Administrator i get an error “failed to run script”. I'm working on this problem for two days, I even try the groovy script example in the nuxeo shell folder but i still get the same error.

Thank you in advance for your help

Additionnal Informations :

Nuxeo Version : 5.5

test.groovy : " println “Hello” " ( this script actually work in the groovyConsole )

0 votes

1 answers




to print a string in nuxeo-shell, just do like this in your groovy script :

def result = ““;

result += “Hello”;

return result;

1 votes

Thank you Vincent for your answer, it works fine. But can you explain to me why the other script don't work please ?(I mean that, "println "Hello"" was from a groovy documentation) Or if you have some documentation about groovy script that works on nuxeo shell, that would be great. Thank you again.

The reason why is how execution of groovy scripts is done in Nuxeo. Here is a link to Nuxeo Shell documentation here.