Search in sources :

Example 1 with AddFileSetsTask

use of org.apache.maven.plugins.assembly.archive.task.AddFileSetsTask in project maven-plugins by apache.

the class FileSetAssemblyPhase method execute.

/**
     * {@inheritDoc}
     */
@Override
public void execute(@Nonnull final Assembly assembly, final Archiver archiver, final AssemblerConfigurationSource configSource) throws ArchiveCreationException, AssemblyFormattingException {
    final List<FileSet> fileSets = assembly.getFileSets();
    if ((fileSets != null) && !fileSets.isEmpty()) {
        final AddFileSetsTask task = new AddFileSetsTask(fileSets);
        task.setLogger(getLogger());
        task.execute(archiver, configSource);
    }
}
Also used : FileSet(org.apache.maven.plugins.assembly.model.FileSet) AddFileSetsTask(org.apache.maven.plugins.assembly.archive.task.AddFileSetsTask)

Example 2 with AddFileSetsTask

use of org.apache.maven.plugins.assembly.archive.task.AddFileSetsTask in project maven-plugins by apache.

the class ModuleSetAssemblyPhase method addModuleSourceFileSets.

void addModuleSourceFileSets(final ModuleSources sources, final Set<MavenProject> moduleProjects, final Archiver archiver, final AssemblerConfigurationSource configSource) throws ArchiveCreationException, AssemblyFormattingException {
    if (sources == null) {
        return;
    }
    final List<FileSet> fileSets = new ArrayList<FileSet>();
    if (isDeprecatedModuleSourcesConfigPresent(sources)) {
        final FileSet fs = new FileSet();
        fs.setOutputDirectory(sources.getOutputDirectory());
        fs.setIncludes(sources.getIncludes());
        fs.setExcludes(sources.getExcludes());
        fs.setUseDefaultExcludes(sources.isUseDefaultExcludes());
        fileSets.add(fs);
    }
    List<FileSet> subFileSets = sources.getFileSets();
    if ((subFileSets == null) || subFileSets.isEmpty()) {
        final FileSet fs = new FileSet();
        fs.setDirectory("src");
        subFileSets = Collections.singletonList(fs);
    }
    fileSets.addAll(subFileSets);
    for (final MavenProject moduleProject : moduleProjects) {
        getLogger().info("Processing sources for module project: " + moduleProject.getId());
        final List<FileSet> moduleFileSets = new ArrayList<FileSet>();
        for (final FileSet fileSet : fileSets) {
            moduleFileSets.add(createFileSet(fileSet, sources, moduleProject, configSource));
        }
        final AddFileSetsTask task = new AddFileSetsTask(moduleFileSets);
        task.setProject(moduleProject);
        task.setModuleProject(moduleProject);
        task.setLogger(getLogger());
        task.execute(archiver, configSource);
    }
}
Also used : FileSet(org.apache.maven.plugins.assembly.model.FileSet) MavenProject(org.apache.maven.project.MavenProject) ArrayList(java.util.ArrayList) AddFileSetsTask(org.apache.maven.plugins.assembly.archive.task.AddFileSetsTask)

Aggregations

AddFileSetsTask (org.apache.maven.plugins.assembly.archive.task.AddFileSetsTask)2 FileSet (org.apache.maven.plugins.assembly.model.FileSet)2 ArrayList (java.util.ArrayList)1 MavenProject (org.apache.maven.project.MavenProject)1