Java Code Examples for org.codehaus.plexus.archiver.util.DefaultFileSet#setUsingDefaultExcludes()

The following examples show how to use org.codehaus.plexus.archiver.util.DefaultFileSet#setUsingDefaultExcludes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DockerAssemblyManager.java    From docker-maven-plugin with Apache License 2.0 6 votes vote down vote up
private TarArchiver createBuildArchiver(File outputDir, File archive, AssemblyConfiguration assemblyConfig) throws NoSuchArchiverException {
    TarArchiver archiver = (TarArchiver) archiverManager.getArchiver("tar");
    archiver.setLongfile(TarLongFileMode.posix);

    AssemblyMode mode = assemblyConfig != null ? assemblyConfig.getMode() : null;
    if (mode != null && mode.isArchive()) {
        DefaultArchivedFileSet archiveSet =
                DefaultArchivedFileSet.archivedFileSet(new File(outputDir,  assemblyConfig.getName() + "." + mode.getExtension()));
        archiveSet.setPrefix(assemblyConfig.getName() + "/");
        archiveSet.setIncludingEmptyDirectories(true);
        archiveSet.setUsingDefaultExcludes(false);
        archiver.addArchivedFileSet(archiveSet);
    } else {
        DefaultFileSet fileSet = DefaultFileSet.fileSet(outputDir);
        fileSet.setUsingDefaultExcludes(false);
        archiver.addFileSet(fileSet);
    }
    archiver.setDestFile(archive);
    return archiver;
}
 
Example 2
Source File: NativeJavahMojo.java    From maven-native with MIT License 5 votes vote down vote up
private void attachGeneratedIncludeFilesAsIncZip()
    throws MojoExecutionException
{
    try
    {
        ZipArchiver archiver = new ZipArchiver();
        DefaultFileSet fileSet = new DefaultFileSet();
        fileSet.setUsingDefaultExcludes( true );
        fileSet.setDirectory( javahOutputDirectory );
        archiver.addFileSet( fileSet );
        archiver.setDestFile( this.incZipFile );
        archiver.createArchive();

        if ( StringUtils.isBlank( this.classifier ) )
        {
            projectHelper.attachArtifact( this.project, INCZIP_TYPE, null, this.incZipFile );
        }
        else
        {
            projectHelper.attachArtifact( this.project, INCZIP_TYPE, this.classifier, this.incZipFile );
        }
    }
    catch ( Exception e )
    {
        throw new MojoExecutionException( "Unable to archive/deploy generated include files", e );
    }
}
 
Example 3
Source File: NativeBundleIncludeFilesMojo.java    From maven-native with MIT License 4 votes vote down vote up
public void execute()
    throws MojoExecutionException
{
    if ( skipIncludeDeployment )
    {
        return;
    }

    if ( this.sources.length != 0 )
    {
        try
        {
            ZipArchiver archiver = new ZipArchiver();

            boolean zipIt = false;
            for ( int i = 0; i < sources.length; ++i )
            {
                if ( sources[i].isDeployable() )
                {
                    DefaultFileSet fileSet = new DefaultFileSet();
                    fileSet.setUsingDefaultExcludes( true );
                    fileSet.setDirectory( sources[i].getDirectory() );
                    fileSet.setIncludes( sources[i].getIncludes() );
                    fileSet.setExcludes( sources[i].getExcludes() );
                    archiver.addFileSet( fileSet );
                    zipIt = true;
                }
            }

            if ( zipIt )
            {
                archiver.setDestFile( this.incZipFile );
                archiver.createArchive();
                projectHelper.attachArtifact( this.project, INCZIP_TYPE, null, this.incZipFile );
            }
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( e.getMessage(), e );
        }
    }
}