license:check

Full name:

com.mycila:license-maven-plugin:4.0:check

Description:

Check if the source files of the project have a valid license header

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: verify.

Required Parameters

Name Type Since Description
<defaultBasedir> File - The base directory, in which to search for project files. This is named `defaultBaseDirectory` as it will be used as the default value for the base directory. This default value can be overridden in each LicenseSet by setting LicenseSet.basedir.
Default value is: ${basedir}.
User property is: license.basedir.
Alias is: basedir.

Optional Parameters

Name Type Since Description
<aggregate> boolean - You can set this flag to true if you want to check the headers for all modules of your project. Only used for multi-modules projects, to check for example the header licenses from the parent module for all sub modules.
Default value is: false.
User property is: license.aggregate.
<concurrencyFactor> float - 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.
Default value is: 1.5.
User property is: license.concurrencyFactor.
<defaultHeaderDefinitions> String[] - Allows the use of external header definitions files. These files are properties like files. This is named `defaultHeaderDefinitions` as it will be used as the default value for the header definitions. This default value can be overridden in each LicenseSet by setting LicenseSet.headerDefinitions.
Alias is: headerDefinitions.
<defaultProperties> Map - You can set here some properties that you want to use when reading the header file. You can use in your header file some properties like ${year}, ${owner} or whatever you want for the name. They will be replaced when the header file is read by those you specified in the command line, in the POM and in system environment. This is named `defaultProperties` as it will be used as the default value for the properties. This default value can be overridden in each LicenseSet by setting LicenseSet.properties.
Alias is: properties.
<defaultUseDefaultExcludes> boolean - Specify if you want to use default exclusions besides the files you have excluded. Default exclusions exclude CVS and SVN folders, IDE descriptors and so on. This is named `defaultUseDefaultExcludes` as it will be used as the default value for whether to use default excludes. This default value can be overridden in each LicenseSet by setting LicenseSet.useDefaultExcludes.
Default value is: true.
User property is: license.useDefaultExcludes.
Alias is: useDefaultExcludes.
<dryRun> boolean - If dryRun is enabled, calls to license:format and license:remove will not overwrite the existing file but instead write the result to a new file with the same name but ending with `.licensed`.
Default value is: false.
User property is: license.dryRun.
<encoding> String - Specify the encoding of your files. Default to the project source encoding property (project.build.sourceEncoding).
Default value is: ${project.build.sourceEncoding}.
User property is: license.encoding.
<errorMessage> String - (no description)
Default value is: Some files do not have the expected license header.
User property is: license.errorMessage.
<failIfMissing> boolean - You can set this flag to false if you do not want the build to fail when some headers are missing.
Default value is: true.
User property is: license.failIfMissing.
<failIfUnknown> boolean 2.8 You can leave this flag on false if you do not want the build to fail for files that do not have an implicit or explicit comment style definition. Setting this explicitly to true is a safe way to make sure that the effective file type mappings cover all files included from your project.

Default is false for backwards compatibility reasons.


Default value is: false.
User property is: license.failIfUnknown.
<legacyConfigExcludes> String[] - Deprecated. use LicenseSet.excludes
User property is: license.excludes.
Alias is: excludes.
<legacyConfigHeader> String - Deprecated. use LicenseSet.header
User property is: license.header.
Alias is: header.
<legacyConfigHeaderSections> HeaderSection[] - Deprecated. use LicenseSet.headerSections
Alias is: headerSections.
<legacyConfigIncludes> String[] - Deprecated. use LicenseSet.includes
User property is: license.includes.
Alias is: includes.
<legacyConfigInlineHeader> String - Deprecated. use LicenseSet.inlineHeader
User property is: license.inlineHeader.
Alias is: inlineHeader.
<legacyConfigKeywords> String[] - Deprecated. use LicenseSet.keywords
Alias is: keywords.
<legacyConfigMulti> Multi - Deprecated. use LicenseSet.multi
<legacyConfigValidHeaders> String[] - Deprecated. use LicenseSet.validHeaders
Alias is: validHeaders.
<licenseSets> LicenseSet[] - (no description)
<mapping> LinkedHashMap - Set mapping between document mapping and a supported type to use. This section is very useful when you want to customize the supported extensions. If your project is using file extensions not supported by default by this plugin, you can add a mapping to attach the extension to an existing type of comment. The tag name is the new extension name to support, and the value is the name of the comment type to use.
<nThreads> int - Maven license plugin uses concurrency to check license headers. With this option the number of threads used to check can be specified. If given it take precedence over concurrencyFactor The default is 0 which implies that the default for concurrencyFactor is used.
Default value is: 0.
User property is: license.nThreads.
<quiet> boolean - If you do not want to see the list of file having a missing header, you can add the quiet flag that will shorten the output
Default value is: false.
User property is: license.quiet.
<skip> boolean - Whether to skip the plugin execution
Default value is: false.
User property is: license.skip.
<skipExistingHeaders> boolean - Skip the formatting of files which already contain a detected header.
Default value is: false.
User property is: license.skipExistingHeaders.
<strictCheck> boolean - 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 keep this option set to true.
Default value is: true.
User property is: license.strictCheck.
<useDefaultMapping> boolean - Whether to use the default mapping between file extensions and comment types, or only the one your provide.
Default value is: true.
User property is: license.useDefaultMapping.

Parameter Details

<aggregate>

You can set this flag to true if you want to check the headers for all modules of your project. Only used for multi-modules projects, to check for example the header licenses from the parent module for all sub modules.
  • Type: boolean
  • Required: No
  • User Property: license.aggregate
  • Default: false

<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.
  • Type: float
  • Required: No
  • User Property: license.concurrencyFactor
  • Default: 1.5

<defaultBasedir>

The base directory, in which to search for project files. This is named `defaultBaseDirectory` as it will be used as the default value for the base directory. This default value can be overridden in each LicenseSet by setting LicenseSet.basedir.
  • Type: java.io.File
  • Required: Yes
  • User Property: license.basedir
  • Default: ${basedir}
  • Alias: basedir

<defaultHeaderDefinitions>

Allows the use of external header definitions files. These files are properties like files. This is named `defaultHeaderDefinitions` as it will be used as the default value for the header definitions. This default value can be overridden in each LicenseSet by setting LicenseSet.headerDefinitions.
  • Type: java.lang.String[]
  • Required: No
  • Alias: headerDefinitions

<defaultProperties>

You can set here some properties that you want to use when reading the header file. You can use in your header file some properties like ${year}, ${owner} or whatever you want for the name. They will be replaced when the header file is read by those you specified in the command line, in the POM and in system environment. This is named `defaultProperties` as it will be used as the default value for the properties. This default value can be overridden in each LicenseSet by setting LicenseSet.properties.
  • Type: java.util.Map
  • Required: No
  • Alias: properties

<defaultUseDefaultExcludes>

Specify if you want to use default exclusions besides the files you have excluded. Default exclusions exclude CVS and SVN folders, IDE descriptors and so on. This is named `defaultUseDefaultExcludes` as it will be used as the default value for whether to use default excludes. This default value can be overridden in each LicenseSet by setting LicenseSet.useDefaultExcludes.
  • Type: boolean
  • Required: No
  • User Property: license.useDefaultExcludes
  • Default: true
  • Alias: useDefaultExcludes

<dryRun>

If dryRun is enabled, calls to license:format and license:remove will not overwrite the existing file but instead write the result to a new file with the same name but ending with `.licensed`.
  • Type: boolean
  • Required: No
  • User Property: license.dryRun
  • Default: false

<encoding>

Specify the encoding of your files. Default to the project source encoding property (project.build.sourceEncoding).
  • Type: java.lang.String
  • Required: No
  • User Property: license.encoding
  • Default: ${project.build.sourceEncoding}

<errorMessage>

(no description)
  • Type: java.lang.String
  • Required: No
  • User Property: license.errorMessage
  • Default: Some files do not have the expected license header

<failIfMissing>

You can set this flag to false if you do not want the build to fail when some headers are missing.
  • Type: boolean
  • Required: No
  • User Property: license.failIfMissing
  • Default: true

<failIfUnknown>

You can leave this flag on false if you do not want the build to fail for files that do not have an implicit or explicit comment style definition. Setting this explicitly to true is a safe way to make sure that the effective file type mappings cover all files included from your project.

Default is false for backwards compatibility reasons.

  • Type: boolean
  • Since: 2.8
  • Required: No
  • User Property: license.failIfUnknown
  • Default: false

<legacyConfigExcludes>

Deprecated. use LicenseSet.excludes
Specifies files, which are excluded in the check. By default, only the files matching the default exclude patterns are excluded.
  • Type: java.lang.String[]
  • Required: No
  • User Property: license.excludes
  • Alias: excludes

<legacyConfigHeader>

Deprecated. use LicenseSet.header
Location of the header. It can be a relative path, absolute path, classpath resource, any URL. The plugin first check if the name specified is a relative file, then an absolute file, then in the classpath. If not found, it tries to construct a URL from the location.
  • Type: java.lang.String
  • Required: No
  • User Property: license.header
  • Alias: header

<legacyConfigHeaderSections>

Deprecated. use LicenseSet.headerSections
HeadSections define special regions of a header that allow for dynamic substitution and validation
  • Type: com.mycila.maven.plugin.license.HeaderSection[]
  • Required: No
  • Alias: headerSections

<legacyConfigIncludes>

Deprecated. use LicenseSet.includes
Specifies files, which are included in the check. By default, all files are included.
  • Type: java.lang.String[]
  • Required: No
  • User Property: license.includes
  • Alias: includes

<legacyConfigInlineHeader>

Deprecated. use LicenseSet.inlineHeader
Header, as text, directly in pom file. Using a CDATA section is strongly recommended.
  • Type: java.lang.String
  • Required: No
  • User Property: license.inlineHeader
  • Alias: inlineHeader

<legacyConfigKeywords>

Deprecated. use LicenseSet.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.
  • Type: java.lang.String[]
  • Required: No
  • Alias: keywords

<legacyConfigMulti>

Deprecated. use LicenseSet.multi
Alternative to `header`, `inlineHeader`, or `validHeaders` for use when code is multi-licensed. Whilst you could create a concatenated header yourself, a cleaner approach may be to specify more than one header and have them concatenated together by the plugin. This allows you to maintain each distinct license header in its own file and combined them in different ways.
  • Type: com.mycila.maven.plugin.license.Multi
  • Required: No

<legacyConfigValidHeaders>

Deprecated. use LicenseSet.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.
  • Type: java.lang.String[]
  • Required: No
  • Alias: validHeaders

<licenseSets>

(no description)
  • Type: com.mycila.maven.plugin.license.LicenseSet[]
  • Required: No

<mapping>

Set mapping between document mapping and a supported type to use. This section is very useful when you want to customize the supported extensions. If your project is using file extensions not supported by default by this plugin, you can add a mapping to attach the extension to an existing type of comment. The tag name is the new extension name to support, and the value is the name of the comment type to use.
  • Type: java.util.LinkedHashMap
  • Required: No

<nThreads>

Maven license plugin uses concurrency to check license headers. With this option the number of threads used to check can be specified. If given it take precedence over concurrencyFactor The default is 0 which implies that the default for concurrencyFactor is used.
  • Type: int
  • Required: No
  • User Property: license.nThreads
  • Default: 0

<quiet>

If you do not want to see the list of file having a missing header, you can add the quiet flag that will shorten the output
  • Type: boolean
  • Required: No
  • User Property: license.quiet
  • Default: false

<skip>

Whether to skip the plugin execution
  • Type: boolean
  • Required: No
  • User Property: license.skip
  • Default: false

<skipExistingHeaders>

Skip the formatting of files which already contain a detected header.
  • Type: boolean
  • Required: No
  • User Property: license.skipExistingHeaders
  • Default: false

<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 keep this option set to true.
  • Type: boolean
  • Required: No
  • User Property: license.strictCheck
  • Default: true

<useDefaultMapping>

Whether to use the default mapping between file extensions and comment types, or only the one your provide.
  • Type: boolean
  • Required: No
  • User Property: license.useDefaultMapping
  • Default: true