Package com.google.code.mojo.license
Class AbstractLicenseMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.google.code.mojo.license.AbstractLicenseMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
LicenseCheckMojo,LicenseFormatMojo,LicenseRemoveMojo
public abstract class AbstractLicenseMojo extends org.apache.maven.plugin.AbstractMojoDate: 18-Feb-2008
Author: Mathieu Carbou (mathieu.carbou@gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanaggregateWheter to treat multi-modules projects as only one project (true) or treat multi-module projects separately (false, by default)protected java.io.FilebasedirThe base directory, in which to search for files.protected floatconcurrencyFactorMaven license plugin uses concurrency to check license headers.protected java.lang.StringencodingSet the charcter encoding for filesprotected java.lang.String[]excludesSpecifies files, which are excluded in the check.private ResourceFinderfinderprotected java.lang.StringheaderThe text document containing the license header to check or use for reformattingprotected java.lang.String[]headerDefinitionsAllows the use of external header definitions files.protected java.lang.String[]includesSpecifies files, which are included in the check.protected java.lang.String[]keywordsSpecify the list of keywords to use to detect a header.protected java.util.Map<java.lang.String,java.lang.String>mappingSet mapping between document mapping and a supported type to useprotected org.apache.maven.project.MavenProjectprojectprotected java.util.Map<java.lang.String,java.lang.String>propertiesThe properties to use when reading the header, to replace tokensprotected booleanquietSet this to "true" to cause no outputprotected booleanskipWhether to skip the plugin executionprotected booleanstrictCheckSet to true if you need a strict check against the headers.protected booleanuseDefaultExcludesWhether to use the default excludes when scanning for files.protected booleanuseDefaultMappingWhether to use the default mapping between fiel extensions and comments to use, or only the one your provideprotected java.lang.String[]validHeadersSpecifies additional header files to use when checking for the presence of a valid header in your sources.
-
Constructor Summary
Constructors Constructor Description AbstractLicenseMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String[]buildExcludes()private java.util.Map<java.lang.String,HeaderDefinition>buildHeaderDefinitions()private java.util.Map<java.lang.String,java.lang.String>buildMapping()protected voiddebug(java.lang.String format, java.lang.Object... params)protected voidexecute(Callback callback)protected voidinfo(java.lang.String format, java.lang.Object... params)protected java.lang.String[]listSelectedFiles()protected java.util.Map<java.lang.String,java.lang.String>mergeProperties()protected voidwarn(java.lang.String format, java.lang.Object... params)-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
basedir
protected java.io.File basedir
The base directory, in which to search for files.
-
header
protected java.lang.String header
The text document containing the license header to check or use for reformatting
-
validHeaders
protected java.lang.String[] validHeaders
Specifies additional header files to use when checking for the presence of a valid header in your sources.
When using format goal, this property will be used to detect all valid headers that don't need formatting.
When using remove goal, this property will be used to detect all valid headers that also must be removed.
-
headerDefinitions
protected java.lang.String[] headerDefinitions
Allows the use of external header definitions files. These files are properties like.
-
properties
protected java.util.Map<java.lang.String,java.lang.String> properties
The properties to use when reading the header, to replace tokens
-
includes
protected java.lang.String[] includes
Specifies files, which are included in the check. By default, all files are included.
-
excludes
protected java.lang.String[] excludes
Specifies files, which are excluded in the check. By default, no files are excluded.
-
keywords
protected java.lang.String[] keywords
Specify the list of keywords to use to detect a header. A header must include all keywords to be valid. By default, the word 'copyright' is used. Detection is done case insensitive.
-
useDefaultExcludes
protected boolean useDefaultExcludes
Whether to use the default excludes when scanning for files.
-
aggregate
protected boolean aggregate
Wheter to treat multi-modules projects as only one project (true) or treat multi-module projects separately (false, by default)
-
mapping
protected java.util.Map<java.lang.String,java.lang.String> mapping
Set mapping between document mapping and a supported type to use
-
useDefaultMapping
protected boolean useDefaultMapping
Whether to use the default mapping between fiel extensions and comments to use, or only the one your provide
-
concurrencyFactor
protected float concurrencyFactor
Maven license plugin uses concurrency to check license headers. This factor is used to control the number of threads used to check. The rule is:
<nThreads> = <number of cores> * concurrencyFactor
The default is 1.5.
-
skip
protected boolean skip
Whether to skip the plugin execution
-
quiet
protected boolean quiet
Set this to "true" to cause no output
-
strictCheck
protected boolean strictCheck
Set to true if you need a strict check against the headers. By default, the existence of a header is verified by taking the top portion of a file and checking if it contains the headers text, not considering special characters (spaces, tabs, ...)
We highly recommend to set this option to true. It is by default set to false for backward compatibility
-
encoding
protected java.lang.String encoding
Set the charcter encoding for files
-
project
protected org.apache.maven.project.MavenProject project
-
finder
private ResourceFinder finder
-
-
Method Detail
-
execute
protected final void execute(Callback callback) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
mergeProperties
protected final java.util.Map<java.lang.String,java.lang.String> mergeProperties()
-
listSelectedFiles
protected final java.lang.String[] listSelectedFiles() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
buildExcludes
private java.lang.String[] buildExcludes()
-
info
protected final void info(java.lang.String format, java.lang.Object... params)
-
debug
protected final void debug(java.lang.String format, java.lang.Object... params)
-
warn
protected final void warn(java.lang.String format, java.lang.Object... params)
-
buildMapping
private java.util.Map<java.lang.String,java.lang.String> buildMapping()
-
buildHeaderDefinitions
private java.util.Map<java.lang.String,HeaderDefinition> buildHeaderDefinitions() throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
-