我正在尝试提取没有PARENT目录的从属zip文件,在使用Gradle提取时排除某些文件.
这是我得到的,这有效,但感觉不对,我希望有更好的方法来做到这一点
我提取的Zip文件
jar tf parent-folder-name.zip
parent-folder-name/bin/something.sh
parent-folder-name/bin/something.bat
parent-folder-name/lib/somelib.jar
Run Code Online (Sandbox Code Playgroud)
选项1
task explodeToDist1(type: Copy) {
from zipTree(configurations.extractDist.singleFile)
exclude "**/lib/**"
eachFile {
def newPath = it.relativePath.segments[1..-1].join("/")
it.relativePath = RelativePath.parse(true, newPath)
}
into 'build/dist'
doLast {
def path = buildDir.getPath() + "/dist/parent-folder-name"
def dirToDelete = new File(path)
dirToDelete.deleteOnExit()
}
}
Run Code Online (Sandbox Code Playgroud)
选项2
task explodeToDist2 << {
def unzipDir = new File('build/unzipTmp')
copy {
from zipTree(configurations.extractDist.singleFile)
into unzipDir
}
def rootZipDir = unzipDir.listFiles()[0]
fileTree(rootZipDir){
exclude "**/lib/**"
}.copy {
into 'src/dist'
}
unzipDir.deleteDir()
}
Run Code Online (Sandbox Code Playgroud)
对我来说选项2 …
我正在寻找一个理想的(性能有效且可维护的)存储二进制数据的地方.在我的情况下,这些是图像.我必须做一些图像处理,缩放图像并存储在一个合适的位置,可以通过RESTful服务进行访问.
从我的研究到目前为止,我有几个选择,如:
你想选择哪一个以及为什么会有用的想法或有更好的方法吗?