use of org.codehaus.plexus.archiver.UnArchiver in project sling by apache.
the class PreparePackageMojo method unpack.
/**
* Unpack a file
*/
private void unpack(final File source, final File destination) throws MojoExecutionException {
getLog().debug("Unpacking " + source.getPath() + " to\n " + destination.getPath());
try {
destination.mkdirs();
final UnArchiver unArchiver = archiverManager.getUnArchiver(source);
unArchiver.setSourceFile(source);
unArchiver.setDestDirectory(destination);
unArchiver.extract();
} catch (final NoSuchArchiverException e) {
throw new MojoExecutionException("Unable to find archiver for " + source.getPath(), e);
} catch (final ArchiverException e) {
throw new MojoExecutionException("Unable to unpack " + source.getPath(), e);
}
}
Aggregations