All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.maven.plugin.assembly.artifact.ResolutionManagementInfo Maven / Gradle / Ivy

Go to download

A Maven plugin to create archives of your project's sources, classes, dependencies etc. from flexible assembly descriptors.

There is a newer version: 3.7.1
Show newest version
package org.apache.maven.plugin.assembly.artifact;

import java.util.LinkedHashSet;
import java.util.Set;

import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.artifact.filter.ScopeArtifactFilter;

/**
 * Helper class used to accumulate scopes and modules (with binaries included) 
 * that are used in an assembly, for the purposes of creating an aggregated
 * managed-version map with dependency version conflicts resolved.
 * 
 * @author jdcasey
 */
class ResolutionManagementInfo
{
    private boolean resolutionRequired;
    
    private ScopeArtifactFilter scopeFilter = new ScopeArtifactFilter();
    
    private boolean resolvedTransitively;
    
    private Set enabledProjects = new LinkedHashSet();
    
    ResolutionManagementInfo( MavenProject mainProject )
    {
        enabledProjects.add( mainProject );
    }

    boolean isResolutionRequired()
    {
        return resolutionRequired;
    }

    void setResolutionRequired( boolean resolutionRequired )
    {
        this.resolutionRequired = resolutionRequired;
    }

    boolean isResolvedTransitively()
    {
        return resolvedTransitively;
    }

    void setResolvedTransitively( boolean resolvedTransitively )
    {
        this.resolvedTransitively = resolvedTransitively;
    }

    ScopeArtifactFilter getScopeFilter()
    {
        return scopeFilter;
    }
    
    void enableCompileScope()
    {
        scopeFilter.setIncludeCompileScope( true );
        scopeFilter.setIncludeProvidedScope( true );
        scopeFilter.setIncludeSystemScope( true );
    }

    void enableProvidedScope()
    {
        scopeFilter.setIncludeProvidedScope( true );
    }

    void enableRuntimeScope()
    {
        scopeFilter.setIncludeRuntimeScope( true );
        scopeFilter.setIncludeCompileScope( true );
    }

    void enableTestScope()
    {
        scopeFilter.setIncludeTestScope( true );
        scopeFilter.setIncludeCompileScope( true );
        scopeFilter.setIncludeProvidedScope( true );
        scopeFilter.setIncludeSystemScope( true );
        scopeFilter.setIncludeRuntimeScope( true );
    }

    void enableSystemScope()
    {
        scopeFilter.setIncludeSystemScope( true );
    }
    
    void enableProjectResolution( MavenProject project )
    {
        if ( !enabledProjects.contains( project ) )
        {
            enabledProjects.add( project );
        }
    }

    Set getEnabledProjects()
    {
        return enabledProjects;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy