copy works in gradle but zip gives weird error
gradle
Solution
The reason `copy` works, is because it's a global utility function defined in `Project` (see here). So you can call `copy` from anywhere, and it will work.
On the other hand there is no equivalent `zip` method. Perhaps, because zipping usually need more configuration than copying, like specifying zip archive name, or maybe they just missed it out. This means that you have to use the `task zip(type: Zip){ from ... into ... }` syntax for zip.
Problem
I am trying to use the zip in gradle and my build worked fine until I added this to my section for the "webserver" project (maybe my question should be why does the copy work without task in front of it?????...I am just really confused by the difference between copy and zip if you need task in front of zip but not copy below) ``` assemble << { zip { from '.' includes ['app/*','conf/*','public/*','play-1.2.4/*','run*.sh'] } } ``` The error is - What went wrong: Execution failed for task ':webserver:assemble'. Could not find method zip() for arguments [build_3nljqgmljp29v06751h102sq8b$_run_closure3_closure16_closure18@7cc8e407] on task ':webserver:assemble'. I don't understand as I am using copy successfully like so ``` copy { from fixedLibDir into genLibDir } ``` Also, I am getting really really confused by the documentation as in the documentation, they almost always have ``` task myZip(type: Zip) { } ``` I just want to call a zip task not create a new one every time, so the documentation examples seem to be very bad...they should be examples of using zip task not creating a new one(after all, who wants to create a new zip task when one already exists??) OR am I missing something here? At any rate, that confused me when getting started with gradle alot and I am guessing it will confuse others. It might be nice to show both using it and defining a new one(though I still don't get why I would define a new one). MORE INFO/UPDATE: I also tried this code which runs and I see the print out message but I see no zip file in my webserver/output/libs directory as I would expect??? ``` assemble << { println "I'm zipping up now" task zip(type: Zip) { from('.') { fileMode = 0755 include 'run*.sh' include 'app/*' } } } ``` later, Dean