1

I have a xqy file with path a/b/sample.xqy in ml-gradle project which is inserting a custom dictionary in to the DB.

I want to run that xquery file as part of a gradle task. I am able to run the code by providing the code in string format but wanted to run through a file.

Please help:

Gradle task:

task Task1(type: com.marklogic.gradle.task.ServerEvalTask) {
    
    xquery = <how to run the sample.xqy here>
}
Dixit Singla
  • 2,540
  • 3
  • 24
  • 39
ravvi
  • 117
  • 6

1 Answers1

0

As suggested by tim_yates, and also mentioned here, you can use something like this:

task Task1(type: com.marklogic.gradle.task.ServerEvalTask) {
    String fileContents = new File('oneplusone.xqy').getText('UTF-8')
    xquery = fileContents
}

Any output is printed to console:

> Task :Task1
Task ':Task1' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
2
Releasing connection

HTH!

grtjn
  • 20,254
  • 1
  • 24
  • 35