How to unpack an .iso file with gradle?

I need to download an .iso file (a dvd image) from an artifact server (nexus in my case) and extract its contents in some local target directory.
Is this possible with gradle native functions/tasks, or is there perhaps a plugin capable of doing this?

Downloading the file is easy. You have full native support for downloading if in a supported repository format (i.e. published to a Maven repository with an ISO extension for the artifact). Something like this should work (exact syntax untested):

configurations {
    iso
}

dependencies {
    iso 'com.example.group:artifactId:version@iso'
}

task retrieveISO(type: Copy) {
    from configurations.iso
    into "${buildDir}/iso"
}

Otherwise, you can use a Download plugin if it’s just a raw storage repository on Nexus.

There is not native support for extracting the contents of the ISO file. You will need to write your own task that utilizes a library (such as https://github.com/stephenc/java-iso-tools) that can read and extract the contents of the ISO file. I am not aware of any third party plugin that already does this specifically.

1 Like