【发布时间】:2017-11-22 10:58:48
【问题描述】:
等级:如何自定义processResources来改变jar中的资源文件路径?
例如:
foo/a.xml --> foo/bar/a.xml
类似于:
copy tree with gradle and change structure?
copy {
from("${sourceDir}") {
include 'modules/**/**'
}
into(destDir)
eachFile {details ->
// Top Level Modules
def targetPath = rawPathToModulesPath(details.path)
details.path = targetPath
}
}
....
def rawPathToModulesPath(def path) {
// Standard case modules/name/src -> module-name/src
def modified=path.replaceAll('modules/([^/]+)/.*src/(java/)?(.*)', {"module-${it[1]}/src/${it[3]}"})
return modified
}
如何在 processResources 中添加这个?谢谢。
【问题讨论】:
标签: gradle process path resources