我想创建一个简单的 Zip 存档文件,其中包含我资源目录中的所有 JavaScript 文件。
这是代码:
task zip(type:Zip){
from ('resources/'){
include '*.js'
}
into 'resources'
}
某些原因,这似乎不起作用。我听很多人说只需要 from
和 into
就能创建一个归档文件。有人可以帮帮我吗?我正在使用Gradle v1.0。先谢谢了。
可以尝试类似这样的方法(文档):
task zip(type:Zip) {
from ('resources/')
include '*.js'
into 'resources' // note that this specifies path *in* the archive
destinationDir file('dir') // directory that you want your archive to be placed in
}
task someTask << {
// other code...
task(zipResources, type: Zip) {
destinationDir new File(projectDir, 'resources')
archiveName 'resources.zip'
from 'src/main/webapp'
include '*.js'
}.execute()
task(zipSomethingElse, type: Zip) {
destinationDir buildDir
archiveName 'source-code.zip'
from 'src/main/java'
include '**/*.java'
}.execute()
// some other code...
}
destinationDir(file("target"))
,它似乎可以正常工作。 - amacleod