Search in sources :

Example 11 with NoSuchArchiverException

use of org.codehaus.plexus.archiver.manager.NoSuchArchiverException in project sling by apache.

the class PreparePackageMojo method unpack.

private void unpack(File source, File destination) throws MojoExecutionException {
    getLog().info("Unpacking " + source.getPath() + " to\n  " + destination.getPath());
    try {
        destination.mkdirs();
        UnArchiver unArchiver = archiverManager.getUnArchiver(source);
        unArchiver.setSourceFile(source);
        unArchiver.setDestDirectory(destination);
        unArchiver.extract();
    } catch (NoSuchArchiverException e) {
        throw new MojoExecutionException("Unable to find archiver for " + source.getPath(), e);
    } catch (ArchiverException e) {
        throw new MojoExecutionException("Unable to unpack " + source.getPath(), e);
    }
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) NoSuchArchiverException(org.codehaus.plexus.archiver.manager.NoSuchArchiverException) ArchiverException(org.codehaus.plexus.archiver.ArchiverException) UnArchiver(org.codehaus.plexus.archiver.UnArchiver) NoSuchArchiverException(org.codehaus.plexus.archiver.manager.NoSuchArchiverException)

Example 12 with NoSuchArchiverException

use of org.codehaus.plexus.archiver.manager.NoSuchArchiverException 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);
    }
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) NoSuchArchiverException(org.codehaus.plexus.archiver.manager.NoSuchArchiverException) ArchiverException(org.codehaus.plexus.archiver.ArchiverException) UnArchiver(org.codehaus.plexus.archiver.UnArchiver) NoSuchArchiverException(org.codehaus.plexus.archiver.manager.NoSuchArchiverException)

Aggregations

ArchiverException (org.codehaus.plexus.archiver.ArchiverException)12 NoSuchArchiverException (org.codehaus.plexus.archiver.manager.NoSuchArchiverException)12 UnArchiver (org.codehaus.plexus.archiver.UnArchiver)9 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)7 File (java.io.File)6 IOException (java.io.IOException)3 Artifact (org.apache.maven.artifact.Artifact)3 IncludeExcludeFileSelector (org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector)3 Archiver (org.codehaus.plexus.archiver.Archiver)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 LinkedHashSet (java.util.LinkedHashSet)1 DefaultArtifact (org.apache.maven.artifact.DefaultArtifact)1 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)1 ArtifactResolutionException (org.apache.maven.artifact.resolver.ArtifactResolutionException)1 ArtifactResolutionResult (org.apache.maven.artifact.resolver.ArtifactResolutionResult)1 ArtifactFilter (org.apache.maven.artifact.resolver.filter.ArtifactFilter)1 BootclasspathArtifact (org.apache.maven.plugin.javadoc.options.BootclasspathArtifact)1 DocletArtifact (org.apache.maven.plugin.javadoc.options.DocletArtifact)1 JavadocPathArtifact (org.apache.maven.plugin.javadoc.options.JavadocPathArtifact)1