I am new to gradle and need to write a task for scheduling MarkLogic backup.
So, I want to invoke an XQuery module that uses a config XML for getting details for backup.
So I tried this :
task mlBackupTask(type: com.marklogic.gradle.task.ServerEvalTask) {
def client = hubConfig.newStagingClient()
println client
//DatabaseClient client = DatabaseClientFactory.newClient(host,portno,new DatabaseClientFactory.DigestAuthContext(username, password))
ServerEvaluationCall invoker = client.newServerEval();
String result = invoker.modulePath("/admin/create-backup.xqy").addVariable("config-name", "dev").evalAs(String.class);
}
I tried both :
hubConfig.newStagingClient()
DatabaseClientFactory.newClient(host,portno,new DatabaseClientFactory.DigestAuthContext(username, password))
This doesn't work and just give this error :
Execution failed for task ':mlBackupTask'. java.lang.NullPointerException (no error message)
Could someone please help out on this?