1

我在 ml-gradle 项目中有一个路径为 a/b/sample.xqy 的 xqy 文件,它将自定义字典插入到数据库中。

我想将该 xquery 文件作为 gradle 任务的一部分运行。我可以通过以字符串格式提供代码来运行代码,但想通过文件运行。

请帮忙:

摇篮任务:

task Task1(type: com.marklogic.gradle.task.ServerEvalTask) {
    
    xquery = <how to run the sample.xqy here>
}
4

1 回答 1

0

正如 tim_yates 所建议的,也提到了这里,你可以使用这样的东西:

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

任何输出都会打印到控制台:

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

于 2021-07-06T19:18:03.947 回答