Search in sources :

Example 1 with ComponentsXmlArchiverFileFilter

use of org.apache.maven.plugins.assembly.filter.ComponentsXmlArchiverFileFilter in project maven-plugins by apache.

the class DefaultAssemblyArchiver method selectContainerDescriptorHandlers.

// CHECKSTYLE_OFF: LineLength
private List<ContainerDescriptorHandler> selectContainerDescriptorHandlers(List<ContainerDescriptorHandlerConfig> requestedContainerDescriptorHandlers, final AssemblerConfigurationSource configSource) throws InvalidAssemblerConfigurationException // CHECKSTYLE_ON: LineLength
{
    getLogger().debug("All known ContainerDescriptorHandler components: " + (containerDescriptorHandlers == null ? "none; map is null." : "" + containerDescriptorHandlers.keySet()));
    if (requestedContainerDescriptorHandlers == null) {
        requestedContainerDescriptorHandlers = new ArrayList<ContainerDescriptorHandlerConfig>();
    }
    final List<ContainerDescriptorHandler> handlers = new ArrayList<ContainerDescriptorHandler>();
    final List<String> hints = new ArrayList<String>();
    if (!requestedContainerDescriptorHandlers.isEmpty()) {
        for (final ContainerDescriptorHandlerConfig config : requestedContainerDescriptorHandlers) {
            final String hint = config.getHandlerName();
            final ContainerDescriptorHandler handler = containerDescriptorHandlers.get(hint);
            if (handler == null) {
                throw new InvalidAssemblerConfigurationException("Cannot find ContainerDescriptorHandler with hint: " + hint);
            }
            getLogger().debug("Found container descriptor handler with hint: " + hint + " (component: " + handler + ")");
            if (config.getConfiguration() != null) {
                getLogger().debug("Configuring handler with:\n\n" + config.getConfiguration() + "\n\n");
                configureContainerDescriptorHandler(handler, (Xpp3Dom) config.getConfiguration(), configSource);
            }
            handlers.add(handler);
            hints.add(hint);
        }
    }
    if (!hints.contains("plexus")) {
        handlers.add(new ComponentsXmlArchiverFileFilter());
    }
    return handlers;
}
Also used : ContainerDescriptorHandler(org.apache.maven.plugins.assembly.filter.ContainerDescriptorHandler) ContainerDescriptorHandlerConfig(org.apache.maven.plugins.assembly.model.ContainerDescriptorHandlerConfig) ArrayList(java.util.ArrayList) ComponentsXmlArchiverFileFilter(org.apache.maven.plugins.assembly.filter.ComponentsXmlArchiverFileFilter) InvalidAssemblerConfigurationException(org.apache.maven.plugins.assembly.InvalidAssemblerConfigurationException)

Aggregations

ArrayList (java.util.ArrayList)1 InvalidAssemblerConfigurationException (org.apache.maven.plugins.assembly.InvalidAssemblerConfigurationException)1 ComponentsXmlArchiverFileFilter (org.apache.maven.plugins.assembly.filter.ComponentsXmlArchiverFileFilter)1 ContainerDescriptorHandler (org.apache.maven.plugins.assembly.filter.ContainerDescriptorHandler)1 ContainerDescriptorHandlerConfig (org.apache.maven.plugins.assembly.model.ContainerDescriptorHandlerConfig)1