Unpacking tar.gz to the root directory with Gradle

My project contains several tar.gz files that I need to extract to the project root directory.

I did this as a test:

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

When I run it, it throws this exception: org.gradle.api.UncheckedIOException: java.io.IOException: the process cannot access the file because another process has blocked part of the file.

I am using Gradle 1.1 on Windows 7.

Thanks for the help.

+6
source share
1 answer

I managed to extract it using this:

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

My only assumption is that either the dir file or the tgz file, or both are locked during the configuration phase and released during the execution phase.

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

+10
source

All Articles