Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unpacking tar.gz into root dir with Gradle

Tags:

gradle

extract

My project contains a couple of tar.gz files that I need to extract to the root directory of the project.

I made this as a test:

task untar (type: Copy) {
    from tarTree(resources.gzip('model.tar.gz'))
    into getProjectDir() 
}

When I run it, it's throwing this exception: org.gradle.api.UncheckedIOException: java.io.IOException: The process cannot access the file because another process has locked a portion of the file.

I'm using Gradle 1.1 in Windows 7.

Thanks for the help.

like image 625
user1294431 Avatar asked Oct 22 '12 18:10

user1294431


1 Answers

I was able to extract it using this:

task test {
    doLast {
        copy {
            from tarTree(resources.gzip('model.tar.gz'))
            into getProjectDir()
        }
    }
}

My only guess is that either the dir or the tgz file or both are locked during the configuration phase and it's released during the execution phase.

If someone has a solution using the copy task and not the copy method I would appreciate it.

like image 182
user1294431 Avatar answered Oct 17 '22 00:10

user1294431