Search in sources :

Example 51 with ArchiverException

use of org.codehaus.plexus.archiver.ArchiverException in project project-build-plugin by axonivy.

the class IarPackagingMojo method createIvyArchive.

private void createIvyArchive(File sourceDir, File targetIar) throws MojoExecutionException {
    ZipArchiver archiver = new ZipArchiver();
    archiver.setDestFile(targetIar);
    archiver.addFileSet(getDefaultFileset(sourceDir));
    FileSetConverter fsConverter = new FileSetConverter(project.getBasedir());
    for (org.codehaus.plexus.archiver.FileSet fs : fsConverter.toPlexusFileSets(iarFileSets)) {
        archiver.addFileSet(fs);
    }
    try {
        archiver.createArchive();
    } catch (ArchiverException | IOException ex) {
        throw new MojoExecutionException("Failed to create IAR: " + targetIar.getAbsolutePath(), ex);
    }
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ZipArchiver(org.codehaus.plexus.archiver.zip.ZipArchiver) ArchiverException(org.codehaus.plexus.archiver.ArchiverException) IOException(java.io.IOException) FileSetConverter(ch.ivyteam.ivy.maven.util.FileSetConverter)

Aggregations

ArchiverException (org.codehaus.plexus.archiver.ArchiverException)51 File (java.io.File)33 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)26 IOException (java.io.IOException)25 NoSuchArchiverException (org.codehaus.plexus.archiver.manager.NoSuchArchiverException)17 UnArchiver (org.codehaus.plexus.archiver.UnArchiver)9 Artifact (org.apache.maven.artifact.Artifact)8 ManifestException (org.codehaus.plexus.archiver.jar.ManifestException)8 DependencyResolutionRequiredException (org.apache.maven.artifact.DependencyResolutionRequiredException)7 MavenArchiver (org.apache.maven.archiver.MavenArchiver)6 ArchiveCreationException (org.apache.maven.plugins.assembly.archive.ArchiveCreationException)5 ArrayList (java.util.ArrayList)3 MojoFailureException (org.apache.maven.plugin.MojoFailureException)3 Archiver (org.codehaus.plexus.archiver.Archiver)3 JarArchiver (org.codehaus.plexus.archiver.jar.JarArchiver)3 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 FileWriter (java.io.FileWriter)2 OutputStreamWriter (java.io.OutputStreamWriter)2 PrintWriter (java.io.PrintWriter)2