I'm trying to create a simple Zip archive that contains all the javascript files in my resources directory
Here's the code:
task zip(type:Zip){
from ('resources/'){
include '*.js'
}
into 'resources'
}
This does not seem to work for some reason. I've heard many people saying that all you need is a from
and into
to create an archive. Can someone help me here ? I'm using Gradle v1.0. Thanks in advance.
Try something like this (docs):
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...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With