我在一个 zip 文件中有这个结构
classes
|--com: A.class, B.class
|--org: C.class, D.class
|--android: X.class
|--stuff: Stuff.inf, info.txt
我希望能够只提取带有 .class 文件的文件夹:com、org、android。并将它们放在罐子上。到目前为止,我已经这样做了:
task createJar {
//unzip the file
FileTree zip = zipTree('runtime.jar')
FileTree zip2 = zip.matching {
include 'classes/**/*.class'
}
zip2.each { file -> println "doing something with $file" }
//create the jar
jar{
from zip2
destinationDir file('GradleTests/testResult')
}
}
但是我得到了带有类文件夹的jar,比如:classes/org/apache/http/entity/mime/content/StringBody.class
我想要它:org/apache/http/entity/mime/content/StringBody.class
知道怎么做吗?谢谢!