gradle war 重命名文件常规 exp 无效
gradle war rename file regular exp not working
Gradle war: 重命名文件不能使用常规表达式。
war {
into "foo"
from ("hello/world") {
include "bar/config/*.xml"
// remove bar/ in the path
rename '(.*)/bar/config/(.*)', '/config/'
// tried
// rename 'bar/config/(.*)', 'config/'
}
}
正在尝试重命名
foo/bar/config/*.xml -> foo/config/*.xml
war.
中的入口路径未更改
rename
正在对文件 name 进行操作,而不是完整路径。要更改路径,您需要访问 FileCopyDetails
对象。一种方法是使用 filesMatching()
:
war {
from('hello/world') {
includeEmptyDirs = false
include 'bar/config/*.xml'
filesMatching('**/*.xml') {
it.path = it.path.replace('bar/', '')
}
}
}
Gradle war: 重命名文件不能使用常规表达式。
war {
into "foo"
from ("hello/world") {
include "bar/config/*.xml"
// remove bar/ in the path
rename '(.*)/bar/config/(.*)', '/config/'
// tried
// rename 'bar/config/(.*)', 'config/'
}
}
正在尝试重命名
foo/bar/config/*.xml -> foo/config/*.xml
war.
中的入口路径未更改rename
正在对文件 name 进行操作,而不是完整路径。要更改路径,您需要访问 FileCopyDetails
对象。一种方法是使用 filesMatching()
:
war {
from('hello/world') {
includeEmptyDirs = false
include 'bar/config/*.xml'
filesMatching('**/*.xml') {
it.path = it.path.replace('bar/', '')
}
}
}