Search in sources :

Example 1 with DefaultArchivedFileSet

use of org.codehaus.plexus.archiver.util.DefaultArchivedFileSet in project maven-plugins by apache.

the class AssemblyProxyArchiver method addArchivedFileSet.

/**
     * {@inheritDoc}
     */
@Override
public void addArchivedFileSet(@Nonnull final File archiveFile, final String prefix) {
    inPublicApi.set(Boolean.TRUE);
    try {
        final DefaultArchivedFileSet fs = new DefaultArchivedFileSet(archiveFile);
        fs.setPrefix(rootPrefix + prefix);
        fs.setFileSelectors(selectors);
        debug("Adding archived file-set in: " + archiveFile + " to archive location: " + fs.getPrefix());
        delegate.addArchivedFileSet(fs);
    } finally {
        inPublicApi.set(null);
    }
}
Also used : DefaultArchivedFileSet(org.codehaus.plexus.archiver.util.DefaultArchivedFileSet)

Example 2 with DefaultArchivedFileSet

use of org.codehaus.plexus.archiver.util.DefaultArchivedFileSet in project maven-plugins by apache.

the class AddArtifactTask method unpacked.

private void unpacked(Archiver archiver, String destDirectory) throws ArchiveCreationException {
    String outputLocation = destDirectory;
    if ((outputLocation.length() > 0) && !outputLocation.endsWith("/")) {
        outputLocation += "/";
    }
    String[] includesArray = TypeConversionUtils.toStringArray(includes);
    if (includesArray == null) {
        includesArray = DEFAULT_INCLUDES_ARRAY;
    }
    final String[] excludesArray = TypeConversionUtils.toStringArray(excludes);
    try {
        final File artifactFile = artifact.getFile();
        if (artifactFile == null) {
            logger.warn("Skipping artifact: " + artifact.getId() + "; it does not have an associated file or directory.");
        } else if (artifactFile.isDirectory()) {
            logger.debug("Adding artifact directory contents for: " + artifact + " to: " + outputLocation);
            DefaultFileSet fs = DefaultFileSet.fileSet(artifactFile);
            fs.setIncludes(includesArray);
            fs.setExcludes(excludesArray);
            fs.setPrefix(outputLocation);
            fs.setStreamTransformer(transformer);
            archiver.addFileSet(fs);
        } else {
            logger.debug("Unpacking artifact contents for: " + artifact + " to: " + outputLocation);
            logger.debug("includes:\n" + StringUtils.join(includesArray, "\n") + "\n");
            logger.debug("excludes:\n" + (excludesArray == null ? "none" : StringUtils.join(excludesArray, "\n")) + "\n");
            DefaultArchivedFileSet afs = DefaultArchivedFileSet.archivedFileSet(artifactFile);
            afs.setIncludes(includesArray);
            afs.setExcludes(excludesArray);
            afs.setPrefix(outputLocation);
            afs.setStreamTransformer(transformer);
            archiver.addArchivedFileSet(afs, encoding);
        }
    } catch (final ArchiverException e) {
        throw new ArchiveCreationException("Error adding file-set for '" + artifact.getId() + "' to archive: " + e.getMessage(), e);
    }
}
Also used : DefaultFileSet(org.codehaus.plexus.archiver.util.DefaultFileSet) DefaultArchivedFileSet(org.codehaus.plexus.archiver.util.DefaultArchivedFileSet) ArchiverException(org.codehaus.plexus.archiver.ArchiverException) ArchiveCreationException(org.apache.maven.plugins.assembly.archive.ArchiveCreationException) File(java.io.File)

Example 3 with DefaultArchivedFileSet

use of org.codehaus.plexus.archiver.util.DefaultArchivedFileSet in project maven-plugins by apache.

the class AssemblyProxyArchiver method addArchivedFileSet.

/**
     * {@inheritDoc}
     */
@Override
public void addArchivedFileSet(final File archiveFile, final String[] includes, final String[] excludes) {
    inPublicApi.set(Boolean.TRUE);
    try {
        final DefaultArchivedFileSet fs = new DefaultArchivedFileSet(archiveFile);
        fs.setIncludes(includes);
        fs.setExcludes(excludes);
        fs.setPrefix(rootPrefix);
        fs.setFileSelectors(selectors);
        debug("Adding archived file-set in: " + archiveFile + " to archive location: " + fs.getPrefix());
        delegate.addArchivedFileSet(fs);
    } finally {
        inPublicApi.set(null);
    }
}
Also used : DefaultArchivedFileSet(org.codehaus.plexus.archiver.util.DefaultArchivedFileSet)

Example 4 with DefaultArchivedFileSet

use of org.codehaus.plexus.archiver.util.DefaultArchivedFileSet in project maven-plugins by apache.

the class AssemblyProxyArchiver method addArchivedFileSet.

/**
     * {@inheritDoc}
     */
@Override
public void addArchivedFileSet(@Nonnull final File archiveFile, final String prefix, final String[] includes, final String[] excludes) {
    inPublicApi.set(Boolean.TRUE);
    try {
        final DefaultArchivedFileSet fs = new DefaultArchivedFileSet(archiveFile);
        fs.setIncludes(includes);
        fs.setExcludes(excludes);
        fs.setPrefix(rootPrefix + prefix);
        fs.setFileSelectors(selectors);
        debug("Adding archived file-set in: " + archiveFile + " to archive location: " + fs.getPrefix());
        delegate.addArchivedFileSet(fs);
    } finally {
        inPublicApi.set(null);
    }
}
Also used : DefaultArchivedFileSet(org.codehaus.plexus.archiver.util.DefaultArchivedFileSet)

Example 5 with DefaultArchivedFileSet

use of org.codehaus.plexus.archiver.util.DefaultArchivedFileSet in project maven-plugins by apache.

the class AssemblyProxyArchiver method addArchivedFileSet.

/**
     * {@inheritDoc}
     */
@Override
public void addArchivedFileSet(@Nonnull final File archiveFile) {
    inPublicApi.set(Boolean.TRUE);
    try {
        final DefaultArchivedFileSet fs = new DefaultArchivedFileSet(archiveFile);
        fs.setPrefix(rootPrefix);
        fs.setFileSelectors(selectors);
        debug("Adding archived file-set in: " + archiveFile + " to archive location: " + fs.getPrefix());
        delegate.addArchivedFileSet(fs);
    } finally {
        inPublicApi.set(null);
    }
}
Also used : DefaultArchivedFileSet(org.codehaus.plexus.archiver.util.DefaultArchivedFileSet)

Aggregations

DefaultArchivedFileSet (org.codehaus.plexus.archiver.util.DefaultArchivedFileSet)5 File (java.io.File)1 ArchiveCreationException (org.apache.maven.plugins.assembly.archive.ArchiveCreationException)1 ArchiverException (org.codehaus.plexus.archiver.ArchiverException)1 DefaultFileSet (org.codehaus.plexus.archiver.util.DefaultFileSet)1