I would like to execute a XQuery script directly from Gradle instead of from QConsole. How to do that?
Is there a mlGradle task for that? Or we could define a task like running MLCP from gradle?
You can create a custom task that extends the ServerEvalTask.
As demonstrated in the Custom tasks that talk to the Client REST API WIKI page
task myXQueryTask(type: com.marklogic.gradle.task.ServerEvalTask) {
xquery = "my XQuery code here"
}
If you are looking to read the contents of the code from a particular file, instead of a static string, then could instead do something like:
new File('/path/to/file').getText('UTF-8')