This works:
http://gradle.1045684.n5.nabble.com/add-Copy-Task-programmatically-best-practice-td1432655.html
task extractTar(type: Copy) {
configurations.upstreamArchives.findAll{it.name.endsWith('.tar')}.each {
from tarTree(it)
}
into buildDir
}
It doesn't work with compressed archives.
On Mon, Mar 7, 2011 at 1:03 PM, Brett Cave <[email protected]> wrote:
> This is not working either:
>
> task extractTar << {
> copy {
> from tarTree('hardcoded/path/to/archive.tar')
> into buildDir
> }
> }
>
> It's a straighforward copy from tar (with no compression), using a
> hardcoded path to an archive. gradle version is 1.0-milestone-1
>
>
>
>
> On Mon, Mar 7, 2011 at 12:38 PM, Brett Cave <[email protected]> wrote:
>
>> I am trying to extract a tar.bz2 archive that is added to a repository
>> from an upstream build. I came across this thread:
>>
>> http://gradle.1045684.n5.nabble.com/built-in-unzip-support-for-zip-and-tar-gz-td1431871.html
>>
>> This is what I have:
>>
>> configurations {
>> upstreamArchive
>> }
>>
>> depedencies {
>> upstreamArchive "my.group:artifactId:[email protected]"
>> }
>>
>> task extractFiles << {
>> theArchives = configurations.upstreamArchive.resolve()
>> theArchives.each {
>> copy {
>> from tarTree(it)
>> into buildDir
>> }
>> }
>>
>> It runs without error, but no files are extracted into buildDir
>>
>>
>
>
>
--
Brett Cave
Systems Architect
Jemstep, Inc
www.jemstep.com