We're trying to build up a minorly complicated Zip file in Gradle from multiple filesystem source trees, but no matter how many into
specifications we give, it all puts them in the same one. Is this possible to do in Gradle?
build/libs/foo.jar --> foo.jar
bar/* --> bar/*
We're getting this instead:
build/libs/foo.jar --> bar/foo.jar
bar/* --> bar/*
Using this:
task installZip(type: Zip, dependsOn: jar) {
from('build/libs/foo.jar').into('.')
from('bar').into('bar')
}
Any help would be appreciated.
EDIT: Gradle 1.0-milestone-3
Apparently the comments to an answer will not allow for a convenient way to show more code... or it isn't obvious :) I have a project which is for a client... so I can't share the full project / build file. Here is what I can share (I changed the project specific acron to XXX):
task zip(type: Zip) { from jar.outputs.files from('scripts/') { fileMode = 0755 include '**/runXXX.sh' include '**/runXXX.bat' } from('lib/') { include '**/*.jar' into('lib') } from('.') { include 'xxx.config' } }
This creates a zip with the project jar in the root of the zip. Copies the scripts from a directory to the root, copies the config file to the root and creates a directory in the root of the zip named /lib and copies all the jars from the project /lib to the zip/lib.
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