我目前正在开发一个 Gradle 插件,该插件的 JAR 包含一个 XSL 文件,我想在xslt
Gradle 调用的 Ant 任务中使用该文件:
ant.xslt(in: reports.xml.destination,
out: new File(reports.xml.destination.parent, basename + '.html')) {
style {
// From https://svn.apache.org/repos/asf/hive/trunk/checkstyle/checkstyle-noframes-sorted.xsl.
javaresource(name: 'checkstyle-noframes-sorted.xsl')
}
}
但是,尽管我已经checkstyle-noframes-sorted.xsl
将插件 JAR 中的几乎每个目录都包含在内,但我仍然得到
Caused by: : stylesheet checkstyle-noframes-sorted.xsl doesn't exist.
at org.apache.tools.ant.taskdefs.XSLTProcess.handleError(XSLTProcess.java:1413)
所以我猜要么 theclasspath
要么 theloaderRef
要么 两者都是错误的。在阅读了类似问题的几个 答案后,我尝试了几种组合,但它们都产生了相同的错误。
为了让 Gradle 插件发现嵌入到其 JAR 中的资源,我需要指定什么?