On Tue, Apr 6, 2010 at 11:45 AM, Geronimo M. H. <[email protected]>wrote:

> Hello,
>
> I tried to extend a task, where I collect things for the installer, by an
> archive action, but that failed with:
>
> error "Could not find method jar() for arguments"
>
> task myTask << {
>        def files = ... collect ...
>
>        copy {
>                from files
>                into  myTempDir
>        }
>        ...
>
>        jar {
>                basename 'testArchive'
>                from myTempDir
>        }
> }


> Is that function-style task (?) only available for 'copy' or what am I
> missing?
>

Yes. We simply haven't gotten around yet to provide similar methods for
jar/tar/zip.

Beside the fact that those methods should be offered, you might already have
a better way to solve your scenario. If your scenario is to provide (on
demand) both an archive and an exploded archive, you can do:

distSpec = copySpec {
   into('bin') {
      from 'src/bin'
      exclude '*.properties'
      fileMode = 0755
      dirMode = 0755
   }
   from('src/toplevel')
}

task distZip(type: Zip) {
   from distSpec
}

task install(type: Copy) {
   from distSpec
   into installDir
}

We usually try to avoid creating temporary dirs just for building an
archive. Often this involves intermediate data that get's stale (i.e. lib
directory with jars). It is hard to figure out what goes into the archive
from looking at the build script. This technique is often used because of
limitations of the build systems. With the Gradle archive API this is no
longer an issue. Thus usually the archive should declare what goes in it.

- Hans

--
Hans Dockter
Founder, Gradle
http://www.gradle.org, http://twitter.com/gradleorg
CEO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz




> kind regards
>
> Geronimo
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to