Search in sources :

Example 1 with FileSetConverter

use of ch.ivyteam.ivy.maven.util.FileSetConverter 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

FileSetConverter (ch.ivyteam.ivy.maven.util.FileSetConverter)1 IOException (java.io.IOException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ArchiverException (org.codehaus.plexus.archiver.ArchiverException)1 ZipArchiver (org.codehaus.plexus.archiver.zip.ZipArchiver)1