【发布时间】:2015-06-20 23:02:23
【问题描述】:
我有一个带有任务的 Gradle 插件:
@TaskAction
def nyTask() {
def myFlags = project.pluginConfig.myFlags
if myFlags == null {
myFlags = "-arg1 absolutePathToFile/file1.txt -arg2 absolutePathToFile/file2.txt"
// *** this is the part I don't know ***
}
project.exec {
executable aCommand
args myFlags.split()
}
}
myFlags 在插件的扩展中定义。使用插件时,我可以像这样配置它:
myPlugin {
myFlags = "-arg1 absolutePathToFile/file1.txt -arg2 absolutePathToFile/file2.txt"
}
我在插件src/main/resources/文件夹中有一些默认文件,即,
src/main/resources/file1.txt
src/main/resources/file2.txt
如果myFlags == null 那么我想使用资源文件夹中的文件。
问题是我不知道如何获得这些文件的正确路径。
如何获取插件资源文件夹中file1.txt和file2.txt的绝对路径?
【问题讨论】:
-
看来这就是你要找的东西:stackoverflow.com/questions/941754/…
标签: java android groovy gradle build.gradle