license:check

Full name:

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

Description:

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

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: verify.

Required Parameters

Name Type Since Description
basedir File - The base directory, in which to search for project files.
Default value is: ${basedir}.
User property is: license.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.
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.
excludes String[] - Specifies files, which are excluded in the check. By default, only the files matching the default exclude patterns are excluded.
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.
header String - 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 claspath. If not found, it tries to construct a URL from the location
User property is: license.header.
headerDefinitions String[] - Allows the use of external header definitions files. These files are properties like files.
headerSections HeaderSection[] - HeadSections define special regions of a header that allow for dynamic substitution and validation
includes String[] - Specifies files, which are included in the check. By default, all files are included.
keywords String[] - 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.
mapping Map - Set mapping between document mapping and a supported type to use. This section is very useful when you want to customize the supported extensions. Is 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.
properties 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.
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 set this option to true. It is by default set to false for backward compatibility
Default value is: true.
User property is: license.strictCheck.
useDefaultExcludes 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.
Default value is: true.
User property is: license.useDefaultExcludes.
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.
validHeaders String[] - 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.

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

basedir:

The base directory, in which to search for project files.
  • Type: java.io.File
  • Required: Yes
  • User Property: license.basedir
  • Default: ${basedir}

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

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}

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

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

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 claspath. If not found, it tries to construct a URL from the location
  • Type: java.lang.String
  • Required: No
  • User Property: license.header

headerDefinitions:

Allows the use of external header definitions files. These files are properties like files.
  • Type: java.lang.String[]
  • Required: No

headerSections:

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

includes:

Specifies files, which are included in the check. By default, all files are included.
  • Type: java.lang.String[]
  • Required: No

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

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. Is 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.Map
  • Required: No

properties:

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.
  • Type: java.util.Map
  • Required: No

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 set this option to true. It is by default set to false for backward compatibility
  • Type: boolean
  • Required: No
  • User Property: license.strictCheck
  • Default: true

useDefaultExcludes:

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.
  • Type: boolean
  • Required: No
  • User Property: license.useDefaultExcludes
  • 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

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