Fork me on GitHub

license:check-file-header

Full name:

org.codehaus.mojo:license-maven-plugin:2.0.0:check-file-header

Description:

The goal to check if the state of header on project source files.

Attributes:

  • Requires a Maven project to be executed.
  • Since version: 1.2.

Required Parameters

Name Type Since Description
<inceptionYear> Integer 1.0 Inception year of the project.

Will be used as first year of copyright section in new header.


Default value is: ${project.inceptionYear}.
User property is: license.inceptionYear.
<organizationName> String 1.0 Name of project's organization.

Will be used as copyrigth's holder in new header.


Default value is: ${project.organization.name}.
User property is: license.organizationName.
<projectName> String 1.0 Name of project (or module).

Will be used as description section of new header.


Default value is: ${project.name}.
User property is: license.projectName.

Optional Parameters

Name Type Since Description
<addJavaLicenseAfterPackage> boolean 1.2 A flag to add the license header in java files after the package statement.

This is a practice used by many people (apache, codehaus, ...).

Note: By default this property is then to true since it is a good practice.


Default value is: true.
User property is: license.addJavaLicenseAfterPackage.
<addSvnKeyWords> boolean 1.0 A flag to add svn:keywords on new header.

Will add svn keywords :

Id, HeadURL
Note: This parameter is used by the descriptionTemplate, so if you change this template, the parameter could be no more used (depends what you put in your own template...).
Default value is: false.
User property is: license.addSvnKeyWords.
<canUpdateCopyright> boolean 1.0 A flag to authorize update of the copyright part of the header.

Note: By default, do NOT authorize it since copyright part should be handled by developpers (holder can change on each file for example).


Default value is: false.
User property is: license.canUpdateCopyright.
<canUpdateDescription> boolean 1.0 A flag to authorize update of the description part of the header.

Note: By default, do NOT authorize it since description can change on each file).


Default value is: false.
User property is: license.canUpdateDescription.
<canUpdateLicense> boolean 1.0 A flag to authorize update of the license part of the header.

Note: By default, authorize it since license part should always be generated by the plugin.


Default value is: true.
User property is: license.canUpdateLicense.
<copyrightOwners> String 1.6 optional copyright owners.

If not set, organizationName parameter will be used instead.


User property is: license.copyrightOwners.
<descriptionTemplate> String 1.1 Template used to build the description section of the license header.

(This template use freemarker).


Default value is: /org/codehaus/mojo/license/default-file-header-description.ftl.
User property is: license.descriptionTemplate.
<emptyLineAfterHeader> boolean 1.9 A flag to indicate if there should be an empty line after the header.

Checkstyle requires empty line between license header and package statement. If you are using addJavaLicenseAfterPackage=false it could make sense to set this to true.

Note: By default this property is set to false to keep old behavior.
Default value is: false.
User property is: license.emptyLineAfterHeader.
<encoding> String 1.0 Encoding used to read and writes files. Note: If nothing is filled here, we will use the system property file.encoding.
Default value is: ${project.build.sourceEncoding}.
User property is: license.encoding.
<excludes> String[] 1.0 Specific files to excludes, separated by a comma. By default, those file types are excluded:
  • modelisation
  • images

User property is: license.excludes.
<extraExtensions> Map 1.0 To associate extra extension files to an existing comment style.

Keys of the map are the extension of extra files to treat, and the value is the comment style you want to associate.

For example, to treat file with extensions java2 and jdata as java files (says using the java comment style, declare this in your plugin configuration :

<extraExtensions>
<java2>java</java2>
<jdata>java</jdata>
</extraExtensions>

<extraFiles> Map 1.11 To associate extra files to an existing comment style.

Keys of the map are the name of extra files to treat, and the value is the comment style you want to associate.

For example, to treat a file named DockerFile as properties files (says using the properties comment style, declare this in your plugin configuration :

<extraFiles>
<DockerFile>properties</DockerFile>
</extraFiles>

<extraTemplateParameters> Map 1.6 optional extra templates parameters.

If filled, they are available with prefix extra_ to process license content (says the header and license content).


<failOnMissingHeader> boolean 1.2 A flag to fail the build if there is some files with no header are detected.
Default value is: false.
User property is: license.failOnMissingHeader.
<failOnNotUptodateHeader> boolean 1.2 A flag to fail the build if there is some files with headers to update.
Default value is: false.
User property is: license.failOnNotUptodateHeader.
<ignoreNoFileToScan> boolean 1.9 A flag to ignore no files to scan.

This flag will suppress the "No file to scan" warning. This will allow you to set the plug-in in the root pom of your project without getting a lot of warnings for aggregation modules / artifacts.

Note: By default this property is set to false to keep old behavior.
Default value is: false.
User property is: license.ignoreNoFileToScan.
<ignoreTag> String 1.0 A tag to place on files that will be ignored by the plugin.

Sometimes, it is necessary to do this when file is under a specific license.

Note: If no sets, will use the default tag %% Ignore-License


User property is: license.ignoreTag.
<includes> String[] 1.0 Specific files to includes, separated by a comma. By default, it is "** /*".

Note: This parameter is not usable if you are still using a project file descriptor.


User property is: license.includes.
<keepBackup> boolean 1.0 A flag to keep a backup of every modified file.
Default value is: false.
User property is: license.keepBackup.
<licenseName> String 1.0 Name of the license to use in the project.
User property is: license.licenseName.
<licenseResolver> String 1.0 To specify an external extra licenses repository resolver (says the base url of the repository where the license.properties is present).

Note: If you want to refer to a file within this project, start the expression with ${project.baseUri}


User property is: license.licenseResolver.
<lineSeparator> String 1.2 To specify a line separator to use. If not set, will use system property line.separator.
User property is: license.lineSeparator.
<processEndTag> String 1.1 To overwrite the processEndTag used to build header model.

See File header configuration.


User property is: license.processEndTag.
<processStartTag> String 1.1 To overwrite the processStartTag used to build header model.

See File header configuration.


User property is: license.processStartTag.
<roots> String[] 1.0 To specify the base dir from which we apply the license.

Should be on form "root1,root2,rootn".

By default, the main roots are "src, target/generated-sources, target/processed-sources".

Note: If some of these roots do not exist, they will be simply ignored.

Note: This parameter is not useable if you are still using a project file descriptor.


User property is: license.roots.
<sectionDelimiter> String 1.1 To overwrite the sectionDelimiter used to build header model.

See File header configuration.


User property is: license.sectionDelimiter.
<skipCheckLicense> boolean 1.2 A flag to skip the goal.
Default value is: false.
User property is: license.skipCheckLicense.
<trimHeaderLine> boolean 1.14 A flag to indicate if there should be an empty line after the header.

Checkstyle usually requires no trailing whitespace. If it is the case it could make sense to set this to true

Note: By default this property is set to false to keep old behavior.
Default value is: false.
User property is: license.trimHeaderLine.
<useJavaNoReformatCommentStartTag> boolean 1.9 A flag to use for java comment start tag with no reformat syntax /*-.

See http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-141999.html#350


Default value is: true.
User property is: license.useJavaNoReformatCommentStartTag.
<verbose> boolean 1.0 Flag to activate verbose mode. Note: Verbose mode is always on if you starts a debug maven instance (says via -X).
Default value is: ${maven.verbose}.
User property is: license.verbose.

Parameter Details

<addJavaLicenseAfterPackage>

A flag to add the license header in java files after the package statement.

This is a practice used by many people (apache, codehaus, ...).

Note: By default this property is then to true since it is a good practice.

  • Type: boolean
  • Since: 1.2
  • Required: No
  • User Property: license.addJavaLicenseAfterPackage
  • Default: true

<addSvnKeyWords>

A flag to add svn:keywords on new header.

Will add svn keywords :

Id, HeadURL
Note: This parameter is used by the descriptionTemplate, so if you change this template, the parameter could be no more used (depends what you put in your own template...).
  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: license.addSvnKeyWords
  • Default: false

<canUpdateCopyright>

A flag to authorize update of the copyright part of the header.

Note: By default, do NOT authorize it since copyright part should be handled by developpers (holder can change on each file for example).

  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: license.canUpdateCopyright
  • Default: false

<canUpdateDescription>

A flag to authorize update of the description part of the header.

Note: By default, do NOT authorize it since description can change on each file).

  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: license.canUpdateDescription
  • Default: false

<canUpdateLicense>

A flag to authorize update of the license part of the header.

Note: By default, authorize it since license part should always be generated by the plugin.

  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: license.canUpdateLicense
  • Default: true

<copyrightOwners>

optional copyright owners.

If not set, organizationName parameter will be used instead.

  • Type: java.lang.String
  • Since: 1.6
  • Required: No
  • User Property: license.copyrightOwners

<descriptionTemplate>

Template used to build the description section of the license header.

(This template use freemarker).

  • Type: java.lang.String
  • Since: 1.1
  • Required: No
  • User Property: license.descriptionTemplate
  • Default: /org/codehaus/mojo/license/default-file-header-description.ftl

<emptyLineAfterHeader>

A flag to indicate if there should be an empty line after the header.

Checkstyle requires empty line between license header and package statement. If you are using addJavaLicenseAfterPackage=false it could make sense to set this to true.

Note: By default this property is set to false to keep old behavior.
  • Type: boolean
  • Since: 1.9
  • Required: No
  • User Property: license.emptyLineAfterHeader
  • Default: false

<encoding>

Encoding used to read and writes files. Note: If nothing is filled here, we will use the system property file.encoding.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: license.encoding
  • Default: ${project.build.sourceEncoding}

<excludes>

Specific files to excludes, separated by a comma. By default, those file types are excluded:
  • modelisation
  • images
  • Type: java.lang.String[]
  • Since: 1.0
  • Required: No
  • User Property: license.excludes

<extraExtensions>

To associate extra extension files to an existing comment style.

Keys of the map are the extension of extra files to treat, and the value is the comment style you want to associate.

For example, to treat file with extensions java2 and jdata as java files (says using the java comment style, declare this in your plugin configuration :

<extraExtensions>
<java2>java</java2>
<jdata>java</jdata>
</extraExtensions>
  • Type: java.util.Map
  • Since: 1.0
  • Required: No

<extraFiles>

To associate extra files to an existing comment style.

Keys of the map are the name of extra files to treat, and the value is the comment style you want to associate.

For example, to treat a file named DockerFile as properties files (says using the properties comment style, declare this in your plugin configuration :

<extraFiles>
<DockerFile>properties</DockerFile>
</extraFiles>
  • Type: java.util.Map
  • Since: 1.11
  • Required: No

<extraTemplateParameters>

optional extra templates parameters.

If filled, they are available with prefix extra_ to process license content (says the header and license content).

  • Type: java.util.Map
  • Since: 1.6
  • Required: No

<failOnMissingHeader>

A flag to fail the build if there is some files with no header are detected.
  • Type: boolean
  • Since: 1.2
  • Required: No
  • User Property: license.failOnMissingHeader
  • Default: false

<failOnNotUptodateHeader>

A flag to fail the build if there is some files with headers to update.
  • Type: boolean
  • Since: 1.2
  • Required: No
  • User Property: license.failOnNotUptodateHeader
  • Default: false

<ignoreNoFileToScan>

A flag to ignore no files to scan.

This flag will suppress the "No file to scan" warning. This will allow you to set the plug-in in the root pom of your project without getting a lot of warnings for aggregation modules / artifacts.

Note: By default this property is set to false to keep old behavior.
  • Type: boolean
  • Since: 1.9
  • Required: No
  • User Property: license.ignoreNoFileToScan
  • Default: false

<ignoreTag>

A tag to place on files that will be ignored by the plugin.

Sometimes, it is necessary to do this when file is under a specific license.

Note: If no sets, will use the default tag %% Ignore-License

  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: license.ignoreTag

<inceptionYear>

Inception year of the project.

Will be used as first year of copyright section in new header.

  • Type: java.lang.Integer
  • Since: 1.0
  • Required: Yes
  • User Property: license.inceptionYear
  • Default: ${project.inceptionYear}

<includes>

Specific files to includes, separated by a comma. By default, it is "** /*".

Note: This parameter is not usable if you are still using a project file descriptor.

  • Type: java.lang.String[]
  • Since: 1.0
  • Required: No
  • User Property: license.includes

<keepBackup>

A flag to keep a backup of every modified file.
  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: license.keepBackup
  • Default: false

<licenseName>

Name of the license to use in the project.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: license.licenseName

<licenseResolver>

To specify an external extra licenses repository resolver (says the base url of the repository where the license.properties is present).

Note: If you want to refer to a file within this project, start the expression with ${project.baseUri}

  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • User Property: license.licenseResolver

<lineSeparator>

To specify a line separator to use. If not set, will use system property line.separator.
  • Type: java.lang.String
  • Since: 1.2
  • Required: No
  • User Property: license.lineSeparator

<organizationName>

Name of project's organization.

Will be used as copyrigth's holder in new header.

  • Type: java.lang.String
  • Since: 1.0
  • Required: Yes
  • User Property: license.organizationName
  • Default: ${project.organization.name}

<processEndTag>

To overwrite the processEndTag used to build header model.

See File header configuration.

  • Type: java.lang.String
  • Since: 1.1
  • Required: No
  • User Property: license.processEndTag

<processStartTag>

To overwrite the processStartTag used to build header model.

See File header configuration.

  • Type: java.lang.String
  • Since: 1.1
  • Required: No
  • User Property: license.processStartTag

<projectName>

Name of project (or module).

Will be used as description section of new header.

  • Type: java.lang.String
  • Since: 1.0
  • Required: Yes
  • User Property: license.projectName
  • Default: ${project.name}

<roots>

To specify the base dir from which we apply the license.

Should be on form "root1,root2,rootn".

By default, the main roots are "src, target/generated-sources, target/processed-sources".

Note: If some of these roots do not exist, they will be simply ignored.

Note: This parameter is not useable if you are still using a project file descriptor.

  • Type: java.lang.String[]
  • Since: 1.0
  • Required: No
  • User Property: license.roots

<sectionDelimiter>

To overwrite the sectionDelimiter used to build header model.

See File header configuration.

  • Type: java.lang.String
  • Since: 1.1
  • Required: No
  • User Property: license.sectionDelimiter

<skipCheckLicense>

A flag to skip the goal.
  • Type: boolean
  • Since: 1.2
  • Required: No
  • User Property: license.skipCheckLicense
  • Default: false

<trimHeaderLine>

A flag to indicate if there should be an empty line after the header.

Checkstyle usually requires no trailing whitespace. If it is the case it could make sense to set this to true

Note: By default this property is set to false to keep old behavior.
  • Type: boolean
  • Since: 1.14
  • Required: No
  • User Property: license.trimHeaderLine
  • Default: false

<useJavaNoReformatCommentStartTag>

A flag to use for java comment start tag with no reformat syntax /*-.

See http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-141999.html#350

  • Type: boolean
  • Since: 1.9
  • Required: No
  • User Property: license.useJavaNoReformatCommentStartTag
  • Default: true

<verbose>

Flag to activate verbose mode. Note: Verbose mode is always on if you starts a debug maven instance (says via -X).
  • Type: boolean
  • Since: 1.0
  • Required: No
  • User Property: license.verbose
  • Default: ${maven.verbose}