How does the Gradle runtime configuration for a task differ from the configuration for a filter?

大城市里の小女人 提交于 2020-05-17 06:56:11

问题


I've implemented a Groovy wrapper around some code to instantiate that code as a Gradle (6.2.2) Task:

task xprocTest(type: XMLCalabashTask) {
  input("source", "../src/test/resources/source.xml")
  output("result", "/tmp/x/result.xml")
  pipeline "pipe.xpl"
}

The underlying code searches the classpath for classes with a particular annotation. That works fine and finds about 97 classes so annotated.

I'm trying to implement a wrapper (in Java this time, if that's relevant) around the same code to instantiate that code as a Copy filter (extending BaseParamFilterReader):

task filterTest(type: Copy) {
  into "/tmp/x/a"
  from "../src/test"
  include "**/*.xml"
  filter(XMLCalabashFilter, pipeline:"pipe.xpl")
}

In this context, when the code runs, it finds nothing on the classpath.

I'm assuming this has something to do with the class loader or other configuration in Gradle. The jar file containing the classes is clearly on the class path because it runs the code that attempts to search for annotations. It just doesn't find any.

Is this a surmountable problem?

来源:https://stackoverflow.com/questions/60898982/how-does-the-gradle-runtime-configuration-for-a-task-differ-from-the-configurati

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!