org.codehaus.mojo.license
Class AbstractAddThirdPartyMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.license.AbstractLicenseMojo
          extended by org.codehaus.mojo.license.AbstractAddThirdPartyMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AddThirdPartyMojo, AggregatorAddThirdPartyMojo

public abstract class AbstractAddThirdPartyMojo
extends AbstractLicenseMojo

Abstract mojo for all third-party mojos.

Since:
1.0
Author:
tchemit

Field Summary
protected  String artifactLicenseMapping
          Location of a properties file mapping artifacts without a license to the license that should be used for them.
protected  String bundleThirdPartyPath
          The path of the bundled third party file to produce when generateBundle is on.
protected  String excludedArtifacts
          A filter to exclude some ArtifactsIds
protected  String excludedGroups
          A filter to exclude some GroupIds
protected  String excludedScopes
          A filter to exclude some scopes.
protected  boolean failIfWarning
          A flag to fail the build if at least one dependency was detected without a license.
protected  boolean force
          To force generation of the third-party file even if every thing is up to date.
protected  boolean generateBundle
          A flag to copy a bundled version of the third-party file.
protected  boolean groupByLicense
          A flag to change the grouping of the generated THIRD-PARTY file.
protected  String includedArtifacts
          A filter to include only some ArtifactsIds
protected  String includedGroups
          A filter to include only some GroupIds
protected  String includedScopes
          A filter to include only some scopes, if let empty then all scopes will be used (no filter).
protected  boolean includeTransitiveDependencies
          Include transitive dependencies when downloading license files.
protected  List<String> licenseMerges
          To merge licenses in final file.
protected  File missingFile
          The file where to fill the license for dependencies with unknown license.
static String NO_DEPENDENCIES_MESSAGE
           
protected  File outputDirectory
          Directory where to generate files.
protected  String thirdPartyFilename
          File where license information for third party dependencies gets stored
protected  boolean useMissingFile
          A flag to use the missing licenses file to consolidate the THID-PARTY file.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractAddThirdPartyMojo()
           
 
Method Summary
protected  boolean checkUnsafeDependencies()
           
protected  File copyToFileSystem(String location)
           
protected  File copyToFileSystem(String location, File file)
           
protected  LicenseMap createLicenseMap(SortedMap<String,org.apache.maven.project.MavenProject> dependencies)
          This returns the complete transitive dependency tree keyed by license type after applying some cleanup
protected abstract  SortedProperties createUnsafeMapping()
           
protected  boolean exists(String location)
           
static SortedMap<String,org.apache.maven.project.MavenProject> getArtifactCache()
           
 String getArtifactLicenseMapping()
           
 String getBundleThirdPartyPath()
           
 String getExcludedArtifacts()
           
 String getExcludedGroups()
           
 List<String> getExcludedScopes()
           
 String getIncludedArtifacts()
           
 String getIncludedGroups()
           
 List<String> getIncludedScopes()
           
protected  InputStream getInputStream(String location)
           
 LicenseMap getLicenseMap()
           
 File getMissingFile()
           
 File getOutputDirectory()
           
 SortedMap<String,org.apache.maven.project.MavenProject> getProjectDependencies()
           
 File getThirdPartyFile()
           
 String getThirdPartyFilename()
           
 ThirdPartyTool getThirdPartyTool()
           
 SortedSet<org.apache.maven.project.MavenProject> getUnsafeDependencies()
           
 SortedProperties getUnsafeMappings()
           
protected  void init()
          Method to initialize the mojo before doing any concrete actions.
 boolean isDoGenerate()
           
 boolean isDoGenerateBundle()
           
 boolean isFailIfWarning()
           
 boolean isForce()
           
 boolean isGenerateBundle()
           
 boolean isGroupByLicense()
           
 boolean isUseMissingFile()
           
protected abstract  SortedMap<String,org.apache.maven.project.MavenProject> loadDependencies()
           
 void setArtifactLicenseMapping(String artifactLicenseMapping)
           
 void setBundleThirdPartyPath(String bundleThirdPartyPath)
           
 void setDoGenerate(boolean doGenerate)
           
 void setDoGenerateBundle(boolean doGenerateBundle)
           
 void setExcludedArtifacts(String excludedArtifacts)
           
 void setExcludedGroups(String excludedGroups)
           
 void setExcludedScopes(String excludedScopes)
           
 void setFailIfWarning(boolean failIfWarning)
           
 void setForce(boolean force)
           
 void setGenerateBundle(boolean generateBundle)
           
 void setGroupByLicense(boolean groupByLicense)
           
 void setIncludedArtifacts(String includedArtifacts)
           
 void setIncludedGroups(String includedGroups)
           
 void setIncludedScopes(String includedScopes)
           
 void setMissingFile(File missingFile)
           
 void setOutputDirectory(File outputDirectory)
           
 void setThirdPartyFile(File thirdPartyFile)
           
 void setThirdPartyFilename(String thirdPartyFilename)
           
 void setThirdPartyTool(ThirdPartyTool thridPartyTool)
           
 void setUnsafeDependencies(SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies)
           
 void setUseMissingFile(boolean useMissingFile)
           
protected  void writeThirdPartyFile()
           
 
Methods inherited from class org.codehaus.mojo.license.AbstractLicenseMojo
acceptPackaging, addResourceDir, afterExecute, checkEncoding, checkPackaging, checkSkip, doAction, execute, getBuildTimestamp, getEncoding, getProject, getSession, hasClassPath, isVerbose, rejectPackaging, setEncoding, setProject, setSession, setVerbose
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputDirectory

protected File outputDirectory
Directory where to generate files.

Since:
1.0

thirdPartyFilename

protected String thirdPartyFilename
File where license information for third party dependencies gets stored

Since:
1.0

useMissingFile

protected boolean useMissingFile
A flag to use the missing licenses file to consolidate the THID-PARTY file.

Since:
1.0

missingFile

protected File missingFile
The file where to fill the license for dependencies with unknown license.

Since:
1.0

artifactLicenseMapping

protected String artifactLicenseMapping
Location of a properties file mapping artifacts without a license to the license that should be used for them. This supports classpath notation and any other type of URL Spring 3.1 resource loading can understand. This properties file supports matching by groupId, groupId + artifactId, or groupId+artifactId+version.

Since:
1.0

licenseMerges

protected List<String> licenseMerges
To merge licenses in final file.

Each entry represents a merge (first license is main license to keep), licenses are separated by |.

Example :

 <licenseMerges>
 <licenseMerge>The Apache Software License|Version 2.0,Apache License, Version 2.0</licenseMerge>
 </licenseMerges>
 </pre>

Since:
1.0

bundleThirdPartyPath

protected String bundleThirdPartyPath
The path of the bundled third party file to produce when generateBundle is on.

Note: This option is not available for pom module types.

Since:
1.0

generateBundle

protected boolean generateBundle
A flag to copy a bundled version of the third-party file. This is usefull to avoid for a final application collision name of third party file.

The file will be copied at the bundleThirdPartyPath location.

Since:
1.0

force

protected boolean force
To force generation of the third-party file even if every thing is up to date.

Since:
1.0

failIfWarning

protected boolean failIfWarning
A flag to fail the build if at least one dependency was detected without a license.

Since:
1.0

groupByLicense

protected boolean groupByLicense
A flag to change the grouping of the generated THIRD-PARTY file.

By default, group by dependencies.

If sets to true, the it will group by license type.

Since:
1.0

excludedScopes

protected String excludedScopes
A filter to exclude some scopes.

Since:
1.0

includedScopes

protected String includedScopes
A filter to include only some scopes, if let empty then all scopes will be used (no filter).

Since:
1.0

excludedGroups

protected String excludedGroups
A filter to exclude some GroupIds

Since:
1.0

includedGroups

protected String includedGroups
A filter to include only some GroupIds

Since:
1.0

excludedArtifacts

protected String excludedArtifacts
A filter to exclude some ArtifactsIds

Since:
1.0

includedArtifacts

protected String includedArtifacts
A filter to include only some ArtifactsIds

Since:
1.0

includeTransitiveDependencies

protected boolean includeTransitiveDependencies
Include transitive dependencies when downloading license files.

Since:
1.0

NO_DEPENDENCIES_MESSAGE

public static final String NO_DEPENDENCIES_MESSAGE
See Also:
Constant Field Values
Constructor Detail

AbstractAddThirdPartyMojo

public AbstractAddThirdPartyMojo()
Method Detail

getArtifactCache

public static SortedMap<String,org.apache.maven.project.MavenProject> getArtifactCache()

loadDependencies

protected abstract SortedMap<String,org.apache.maven.project.MavenProject> loadDependencies()

createUnsafeMapping

protected abstract SortedProperties createUnsafeMapping()
                                                 throws org.apache.maven.project.ProjectBuildingException,
                                                        IOException,
                                                        ThirdPartyToolException
Throws:
org.apache.maven.project.ProjectBuildingException
IOException
ThirdPartyToolException

exists

protected boolean exists(String location)

getInputStream

protected InputStream getInputStream(String location)
                              throws IOException
Throws:
IOException

copyToFileSystem

protected File copyToFileSystem(String location)

copyToFileSystem

protected File copyToFileSystem(String location,
                                File file)

init

protected void init()
             throws Exception
Description copied from class: AbstractLicenseMojo
Method to initialize the mojo before doing any concrete actions.

Note: The method is invoked before the AbstractLicenseMojo.doAction() method.

Specified by:
init in class AbstractLicenseMojo
Throws:
Exception - if any

createLicenseMap

protected LicenseMap createLicenseMap(SortedMap<String,org.apache.maven.project.MavenProject> dependencies)
This returns the complete transitive dependency tree keyed by license type after applying some cleanup


checkUnsafeDependencies

protected boolean checkUnsafeDependencies()

writeThirdPartyFile

protected void writeThirdPartyFile()
                            throws IOException
Throws:
IOException

isGroupByLicense

public boolean isGroupByLicense()

setGroupByLicense

public void setGroupByLicense(boolean groupByLicense)

getOutputDirectory

public File getOutputDirectory()

getThirdPartyFilename

public String getThirdPartyFilename()

getBundleThirdPartyPath

public String getBundleThirdPartyPath()

isGenerateBundle

public boolean isGenerateBundle()

isFailIfWarning

public boolean isFailIfWarning()

getProjectDependencies

public SortedMap<String,org.apache.maven.project.MavenProject> getProjectDependencies()

getUnsafeDependencies

public SortedSet<org.apache.maven.project.MavenProject> getUnsafeDependencies()

setUnsafeDependencies

public void setUnsafeDependencies(SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies)

getThirdPartyFile

public File getThirdPartyFile()

getLicenseMap

public LicenseMap getLicenseMap()

setOutputDirectory

public void setOutputDirectory(File outputDirectory)

setThirdPartyFilename

public void setThirdPartyFilename(String thirdPartyFilename)

setBundleThirdPartyPath

public void setBundleThirdPartyPath(String bundleThirdPartyPath)

setGenerateBundle

public void setGenerateBundle(boolean generateBundle)

setThirdPartyFile

public void setThirdPartyFile(File thirdPartyFile)

isUseMissingFile

public boolean isUseMissingFile()

getMissingFile

public File getMissingFile()

setUseMissingFile

public void setUseMissingFile(boolean useMissingFile)

setMissingFile

public void setMissingFile(File missingFile)

setFailIfWarning

public void setFailIfWarning(boolean failIfWarning)

getUnsafeMappings

public SortedProperties getUnsafeMappings()

isForce

public boolean isForce()

isDoGenerate

public boolean isDoGenerate()

setForce

public void setForce(boolean force)

setDoGenerate

public void setDoGenerate(boolean doGenerate)

isDoGenerateBundle

public boolean isDoGenerateBundle()

setDoGenerateBundle

public void setDoGenerateBundle(boolean doGenerateBundle)

getExcludedScopes

public List<String> getExcludedScopes()

setExcludedScopes

public void setExcludedScopes(String excludedScopes)

getIncludedScopes

public List<String> getIncludedScopes()

setIncludedScopes

public void setIncludedScopes(String includedScopes)

getExcludedGroups

public String getExcludedGroups()

setExcludedGroups

public void setExcludedGroups(String excludedGroups)

getIncludedGroups

public String getIncludedGroups()

setIncludedGroups

public void setIncludedGroups(String includedGroups)

getExcludedArtifacts

public String getExcludedArtifacts()

setExcludedArtifacts

public void setExcludedArtifacts(String excludedArtifacts)

getIncludedArtifacts

public String getIncludedArtifacts()

setIncludedArtifacts

public void setIncludedArtifacts(String includedArtifacts)

getThirdPartyTool

public ThirdPartyTool getThirdPartyTool()

setThirdPartyTool

public void setThirdPartyTool(ThirdPartyTool thridPartyTool)

getArtifactLicenseMapping

public String getArtifactLicenseMapping()

setArtifactLicenseMapping

public void setArtifactLicenseMapping(String artifactLicenseMapping)


Copyright © 2010-2012 The Kuali Foundation. All Rights Reserved.