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

org.apache.maven.plugin.assembly.model.ModuleBinaries 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
/*
 * $Id$
 */

package org.apache.maven.plugin.assembly.model;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import java.util.Date;

/**
 * 
 *         Contains configuration options for including the binary
 * files of a
 *         project module in an assembly.
 *       
 * 
 * @version $Revision$ $Date$
 */
public class ModuleBinaries extends SetBase 
implements java.io.Serializable
{


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * 
     *           When specified, the attachmentClassifier will
     * cause the assembler to look at artifacts
     *           attached to the module instead of the main project
     * artifact. If it can find an attached
     *           artifact matching the specified classifier, it
     * will use it; otherwise, it will throw an
     *           exception. (Since 2.2)
     *           .
     */
    private String attachmentClassifier;

    /**
     * 
     *           If set to true, the plugin will include the direct
     * and transitive dependencies of
     *           of the project modules included here.  Otherwise,
     * it will only include the module
     *           packages only. Default value is true.
     *           
     */
    private boolean includeDependencies = true;

    /**
     * Field dependencySets.
     */
    private java.util.List dependencySets;

    /**
     * 
     *             If set to true, this property will unpack all
     * module packages
     *             into the specified output directory. When set to
     * false
     *             module packages will be included as archives
     * (jars).
     *             Default value is true.
     *           
     */
    private boolean unpack = true;

    /**
     * 
     *           Allows the specification of includes and excludes,
     * along with filtering options, for items
     *           unpacked from a module artifact. (Since 2.2)
     *           .
     */
    private UnpackOptions unpackOptions;

    /**
     * 
     *             Sets the mapping pattern for all dependencies
     * included
     *             in this assembly.
     *             Default is
     * ${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}.
     *             (Since 2.2-beta-2; 2.2-beta-1 uses
     * ${artifactId}-${version}${dashClassifier?}.${extension})
     *           .
     */
    private String outputFileNameMapping = "${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}";


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addDependencySet.
     * 
     * @param dependencySet
     */
    public void addDependencySet(DependencySet dependencySet)
    {
        if ( !(dependencySet instanceof DependencySet) )
        {
            throw new ClassCastException( "ModuleBinaries.addDependencySets(dependencySet) parameter must be instanceof " + DependencySet.class.getName() );
        }
        getDependencySets().add( dependencySet );
    } //-- void addDependencySet(DependencySet) 

    /**
     * Get 
     *           When specified, the attachmentClassifier will
     * cause the assembler to look at artifacts
     *           attached to the module instead of the main project
     * artifact. If it can find an attached
     *           artifact matching the specified classifier, it
     * will use it; otherwise, it will throw an
     *           exception. (Since 2.2)
     *           .
     * 
     * @return String
     */
    public String getAttachmentClassifier()
    {
        return this.attachmentClassifier;
    } //-- String getAttachmentClassifier() 

    /**
     * Method getDependencySets.
     * 
     * @return java.util.List
     */
    public java.util.List getDependencySets()
    {
        if ( this.dependencySets == null )
        {
            this.dependencySets = new java.util.ArrayList();
        }
        
        return this.dependencySets;
    } //-- java.util.List getDependencySets() 

    /**
     * Get 
     *             Sets the mapping pattern for all dependencies
     * included
     *             in this assembly.
     *             Default is
     * ${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}.
     *             (Since 2.2-beta-2; 2.2-beta-1 uses
     * ${artifactId}-${version}${dashClassifier?}.${extension})
     *           .
     * 
     * @return String
     */
    public String getOutputFileNameMapping()
    {
        return this.outputFileNameMapping;
    } //-- String getOutputFileNameMapping() 

    /**
     * Get 
     *           Allows the specification of includes and excludes,
     * along with filtering options, for items
     *           unpacked from a module artifact. (Since 2.2)
     *           .
     * 
     * @return UnpackOptions
     */
    public UnpackOptions getUnpackOptions()
    {
        return this.unpackOptions;
    } //-- UnpackOptions getUnpackOptions() 

    /**
     * Get 
     *           If set to true, the plugin will include the direct
     * and transitive dependencies of
     *           of the project modules included here.  Otherwise,
     * it will only include the module
     *           packages only. Default value is true.
     *           
     * 
     * @return boolean
     */
    public boolean isIncludeDependencies()
    {
        return this.includeDependencies;
    } //-- boolean isIncludeDependencies() 

    /**
     * Get 
     *             If set to true, this property will unpack all
     * module packages
     *             into the specified output directory. When set to
     * false
     *             module packages will be included as archives
     * (jars).
     *             Default value is true.
     *           
     * 
     * @return boolean
     */
    public boolean isUnpack()
    {
        return this.unpack;
    } //-- boolean isUnpack() 

    /**
     * Method removeDependencySet.
     * 
     * @param dependencySet
     */
    public void removeDependencySet(DependencySet dependencySet)
    {
        if ( !(dependencySet instanceof DependencySet) )
        {
            throw new ClassCastException( "ModuleBinaries.removeDependencySets(dependencySet) parameter must be instanceof " + DependencySet.class.getName() );
        }
        getDependencySets().remove( dependencySet );
    } //-- void removeDependencySet(DependencySet) 

    /**
     * Set 
     *           When specified, the attachmentClassifier will
     * cause the assembler to look at artifacts
     *           attached to the module instead of the main project
     * artifact. If it can find an attached
     *           artifact matching the specified classifier, it
     * will use it; otherwise, it will throw an
     *           exception. (Since 2.2)
     *           .
     * 
     * @param attachmentClassifier
     */
    public void setAttachmentClassifier(String attachmentClassifier)
    {
        this.attachmentClassifier = attachmentClassifier;
    } //-- void setAttachmentClassifier(String) 

    /**
     * Set 
     *             
     *             Specifies which dependencies of the module to
     * include in the assembly. A
     *             dependencySet is specified by providing one or
     * more of
     *             <dependencySet> subelements. (Since 2.2)
     *             
     *           .
     * 
     * @param dependencySets
     */
    public void setDependencySets(java.util.List dependencySets)
    {
        this.dependencySets = dependencySets;
    } //-- void setDependencySets(java.util.List) 

    /**
     * Set 
     *           If set to true, the plugin will include the direct
     * and transitive dependencies of
     *           of the project modules included here.  Otherwise,
     * it will only include the module
     *           packages only. Default value is true.
     *           
     * 
     * @param includeDependencies
     */
    public void setIncludeDependencies(boolean includeDependencies)
    {
        this.includeDependencies = includeDependencies;
    } //-- void setIncludeDependencies(boolean) 

    /**
     * Set 
     *             Sets the mapping pattern for all dependencies
     * included
     *             in this assembly.
     *             Default is
     * ${module.artifactId}-${module.version}${dashClassifier?}.${module.extension}.
     *             (Since 2.2-beta-2; 2.2-beta-1 uses
     * ${artifactId}-${version}${dashClassifier?}.${extension})
     *           .
     * 
     * @param outputFileNameMapping
     */
    public void setOutputFileNameMapping(String outputFileNameMapping)
    {
        this.outputFileNameMapping = outputFileNameMapping;
    } //-- void setOutputFileNameMapping(String) 

    /**
     * Set 
     *             If set to true, this property will unpack all
     * module packages
     *             into the specified output directory. When set to
     * false
     *             module packages will be included as archives
     * (jars).
     *             Default value is true.
     *           
     * 
     * @param unpack
     */
    public void setUnpack(boolean unpack)
    {
        this.unpack = unpack;
    } //-- void setUnpack(boolean) 

    /**
     * Set 
     *           Allows the specification of includes and excludes,
     * along with filtering options, for items
     *           unpacked from a module artifact. (Since 2.2)
     *           .
     * 
     * @param unpackOptions
     */
    public void setUnpackOptions(UnpackOptions unpackOptions)
    {
        this.unpackOptions = unpackOptions;
    } //-- void setUnpackOptions(UnpackOptions) 


    private String modelEncoding = "UTF-8";

    /**
     * Set an encoding used for reading/writing the model.
     *
     * @param modelEncoding the encoding used when reading/writing the model.
     */
    public void setModelEncoding( String modelEncoding )
    {
        this.modelEncoding = modelEncoding;
    }

    /**
     * @return the current encoding used when reading/writing this model.
     */
    public String getModelEncoding()
    {
        return modelEncoding;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy