org.nuiton.license.plugin
Class AbstractAddThirdPartyMojo

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

public abstract class AbstractAddThirdPartyMojo
extends AbstractLicenseMojo
implements org.nuiton.plugin.PluginWithEncoding

Abstract mojo for all third-party mojos.

Since:
2.3
Author:
tchemit

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
org.nuiton.plugin.Plugin.InitState, org.nuiton.plugin.Plugin.Packaging
 
Field Summary
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  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  List<String> licenseMerges
          To merge licenses in final file.
protected  File missingFile
          The file where to fill the license for dependencies with unknwon license.
static String NO_DEPENDENCIES_MESSAGE
           
protected  File outputDirectory
          Directory where to generate files.
protected  String thirdPartyFilename
          File where to wirte the third-party file.
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 abstract  LicenseMap createLicenseMap()
           
protected abstract  org.nuiton.io.SortedProperties createUnsafeMapping()
           
static SortedMap<String,org.apache.maven.project.MavenProject> getArtifactCache()
           
 String getBundleThirdPartyPath()
           
 String getEncoding()
           
 String getExcludedArtifacts()
           
 String getExcludedGroups()
           
 String getIncludedArtifacts()
           
 String getIncludedGroups()
           
 LicenseMap getLicenseMap()
           
 File getMissingFile()
           
 File getOutputDirectory()
           
 File getThirdPartyFile()
           
 String getThirdPartyFilename()
           
 SortedSet<org.apache.maven.project.MavenProject> getUnsafeDependencies()
           
 org.nuiton.io.SortedProperties getUnsafeMappings()
           
protected  void init()
           
 boolean isDoGenerate()
           
 boolean isDoGenerateBundle()
           
 boolean isFailIfWarning()
           
 boolean isForce()
           
 boolean isGenerateBundle()
           
 boolean isGroupByLicense()
           
 boolean isUseMissingFile()
           
 void setBundleThirdPartyPath(String bundleThirdPartyPath)
           
 void setDoGenerate(boolean doGenerate)
           
 void setDoGenerateBundle(boolean doGenerateBundle)
           
 void setEncoding(String encoding)
           
 void setExcludedArtifacts(String excludedArtifacts)
           
 void setExcludedGroups(String excludedGroups)
           
 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 setMissingFile(File missingFile)
           
 void setOutputDirectory(File outputDirectory)
           
 void setThirdPartyFile(File thirdPartyFile)
           
 void setThirdPartyFilename(String thirdPartyFilename)
           
 void setUseMissingFile(boolean useMissingFile)
           
protected  void writeThirdPartyFile()
           
 
Methods inherited from class org.nuiton.license.plugin.AbstractLicenseMojo
createLicenseStore, getBuildTimestamp, getProject, getSession, isVerbose, setProject, setSession, setVerbose
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, backupFile, checkEncoding, checkPackaging, checkResource, checkRunOnceDone, checkSkip, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, doAction, execute, getBackupFile, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, initClassLoader, isExecutionRoot, isFileNewerThanPomFile, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFile
 
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
 
Methods inherited from interface org.nuiton.plugin.Plugin
getProject, isVerbose, setProject, setVerbose
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute, getLog, setLog
 

Field Detail

outputDirectory

protected File outputDirectory
Directory where to generate files.

Since:
2.3
Is defined by:
expression:
${license.outputDirectory}
default-value:
target/generated-sources/license
Is required.

thirdPartyFilename

protected String thirdPartyFilename
File where to wirte the third-party file.

Since:
2.3
Is defined by:
expression:
${license.thirdPartyFilename}
default-value:
THIRD-PARTY.txt
Is required.

useMissingFile

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

Since:
2.3
Is defined by:
expression:
${license.useMissingFile}
default-value:
false

missingFile

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

Since:
2.3
Is defined by:
expression:
${license.missingFile}
default-value:
src/license/THIRD-PARTY.properties

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:
2.3
Is defined by:

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:
2.3
Is defined by:
expression:
${license.bundleThirdPartyPath}
default-value:
META-INF/${project.artifactId}-THIRD-PARTY.txt

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:
2.3
Is defined by:
expression:
${license.generateBundle}
default-value:
false

force

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

Since:
2.3
Is defined by:
expression:
${license.force}
default-value:
false

failIfWarning

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

Since:
2.3
Is defined by:
expression:
${license.failIfWarning}
default-value:
false

groupByLicense

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

By default, group by dependecies.

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

Since:
2.3
Is defined by:
expression:
${license.groupByLicense}
default-value:
false

excludedGroups

protected String excludedGroups
A filter to exclude some GroupIds

Since:
2.3.2
Is defined by:
expression:
${license.excludedGroups}
default-value:

includedGroups

protected String includedGroups
A filter to include only some GroupIds

Since:
2.3.2
Is defined by:
expression:
${license.includedGroups}
default-value:

excludedArtifacts

protected String excludedArtifacts
A filter to exclude some ArtifactsIds

Since:
2.3.2
Is defined by:
expression:
${license.excludedArtifacts}
default-value:

includedArtifacts

protected String includedArtifacts
A filter to include only some ArtifactsIds

Since:
2.3.2
Is defined by:
expression:
${license.includedArtifacts}
default-value:

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()

createLicenseMap

protected abstract LicenseMap createLicenseMap()
                                        throws org.apache.maven.project.ProjectBuildingException
Throws:
org.apache.maven.project.ProjectBuildingException

createUnsafeMapping

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

init

protected void init()
             throws Exception
Specified by:
init in class org.nuiton.plugin.AbstractPlugin
Throws:
Exception

checkUnsafeDependencies

protected boolean checkUnsafeDependencies()

writeThirdPartyFile

protected void writeThirdPartyFile()
                            throws IOException
Throws:
IOException

getEncoding

public final String getEncoding()
Specified by:
getEncoding in interface org.nuiton.plugin.PluginWithEncoding

setEncoding

public final void setEncoding(String encoding)
Specified by:
setEncoding in interface org.nuiton.plugin.PluginWithEncoding

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()

getUnsafeDependencies

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

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 org.nuiton.io.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)

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)


Copyright © 2008-2010 CodeLutin. All Rights Reserved.