license:add-third-party
Full name:
org.codehaus.mojo:license-maven-plugin:2.4.0:add-third-party
Description:
Goal to generate the third-party license file.
This file contains a list of the dependencies and their licenses. Each dependency and its license is displayed on a single line in the format
(<license-name>) <project-name> <groupId>:<artifactId>:<version> - <project-url>The directory containing the license database file is added to the classpath as an additional resource.
Attributes:
- Requires a Maven project to be executed.
- Requires dependency resolution of artifacts in scope:
test
. - The goal is thread-safe and supports parallel builds.
- Since version:
1.0
. - Binds by default to the lifecycle phase:
generate-resources
.
Required Parameters
Name | Type | Since | Description |
---|---|---|---|
<outputDirectory> |
File |
1.0 |
Directory where to generate files. Default: ${project.build.directory}/generated-sources/license User Property: license.outputDirectory |
<thirdPartyFilename> |
String |
1.0 |
File where to write the third-party file. Default: THIRD-PARTY.txt User Property: license.thirdPartyFilename |
Optional Parameters
Name | Type | Since | Description |
---|---|---|---|
<acceptPomPackaging> |
boolean |
1.1 |
If true the mojo will be executed for reactor projects having any packaging (including pom ); otherwise the mojo will be executed only for projects that do not have packaging pom .
Since 1.18, when Default: false User Property: license.acceptPomPackaging |
<artifactFiltersUrl> |
String |
1.18 |
A URL returning a plain text file that contains include/exclude artifact filters in the following format:
User Property: license.artifactFiltersUrl |
<bundleThirdPartyPath> |
String |
1.0 |
The path of the bundled third party file to produce when generateBundle is on.
Note: This option is not available for Default: META-INF/${project.artifactId}-THIRD-PARTY.txt User Property: license.bundleThirdPartyPath |
<deployMissingFile> |
boolean |
1.0 |
Attach the 'missing' file as an additional artifact so that it is deployed in the deploy phase. Default: true User Property: license.deployMissingFile |
<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: ${project.build.sourceEncoding} User Property: license.encoding |
<excludedArtifacts> |
String |
1.1 |
A regular expression (not glob pattern) used as filter to exclude artifacts that have matching artifactId. Match could be also partial for example ^org\.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor. By default if an artifact is excluded its transitive dependencies are not automatically excluded. To enforce this behavior refer to User Property: license.excludedArtifacts |
<excludedGroups> |
String |
1.1 |
A regular expression (not glob pattern) used as filter to exclude artifacts that have matching groupId. Match could be also partial for example ^org\.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor. By default if an artifact is excluded its transitive dependencies are not automatically excluded. To enforce this behavior refer to User Property: license.excludedGroups |
<excludedLicenses> |
AbstractAddThirdPartyMojo$ExcludedLicenses |
1.1 |
To specify some licenses to exclude.
If a such license is found then build will fail when property Since version
User Property: license.excludedLicenses |
<excludedScopes> |
String |
1.1 |
A comma separated list of scopes to exclude: e.g. <excludedScopes>test,provided</excludedScopes> or -Dlicense.excludedScopes=test,provided .
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor. By default if an artifact is excluded its transitive dependencies are not automatically excluded. To enforce this behavior refer to Default: system User Property: license.excludedScopes |
<excludedTypes> |
String |
1.15 |
A comma separated list of types to exclude: e.g. <excludedTypes>war,pom</excludedTypes> or -Dlicense.excludedTypes=was,pom .
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor. By default if an artifact is excluded its transitive dependencies are not automatically excluded. To enforce this behavior refer to User Property: license.excludedTypes |
<excludeTransitiveDependencies> |
boolean |
1.13 |
If true enforces excluding transitive dependencies of the excluded artifacts in the reactor; otherwise only artifacts that match exclude filters are excluded.Default: false User Property: license.excludeTransitiveDependencies |
<failIfWarning> |
boolean |
1.0 |
Deprecated. A flag to fail the build if at least one dependency was detected without a license. Default: false User Property: license.failIfWarning |
<failOnBlacklist> |
boolean |
1.14 |
A flag to fail the build if at least one dependency was blacklisted. Default: false User Property: license.failOnBlacklist |
<failOnMissing> |
boolean |
1.14 |
A flag to fail the build if at least one dependency was detected without a license. Default: false User Property: license.failOnMissing |
<fileTemplate> |
String |
1.1 |
Template used to build the third-party file.
(This template uses freemarker). Note: This property can either point to a file or a resource on the classpath. In case it points to a file and this plugin is used within a sub-module as part of a multi-module build, you need to make this path resolvable, e.g. by prepending Default: /org/codehaus/mojo/license/third-party-file.ftl User Property: license.fileTemplate |
<force> |
boolean |
1.0 |
To force generation of the third-party file even if everything is up to date. Default: false User Property: license.force |
<generateBundle> |
boolean |
1.0 |
A flag to copy a bundled version of the third-party file. This is useful to avoid for a final application collision name of third party file.
The file will be copied at the Default: false User Property: license.generateBundle |
<includedArtifacts> |
String |
1.1 |
A regular expression (not glob pattern) used as filter to include only artifacts that have matching artifactId.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor. By default if an artifact is included also its transitive dependencies are included. To suppress this behavior refer to User Property: license.includedArtifacts |
<includedGroups> |
String |
1.1 |
A regular expression (not glob pattern) used as filter to include only artifacts that have matching groupId.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor. By default if an artifact is included also its transitive dependencies are included. To suppress this behavior refer to User Property: license.includedGroups |
<includedLicenses> |
AbstractAddThirdPartyMojo$IncludedLicenses |
1.1 |
To specify some licenses to include.
If this parameter is filled and a license is not in this Since version
User Property: license.includedLicenses |
<includedScopes> |
String |
1.1 |
A comma separated list of scopes to include: e.g. <includedScopes>test,provided</includedScopes> or -Dlicense.includedScopes=test,provided .
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor. By default if an artifact is included also its transitive dependencies are included. To suppress this behavior refer to User Property: license.includedScopes |
<includedTypes> |
String |
1.15 |
A comma separated list of types to include.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor. By default if an artifact is included also its transitive dependencies are included. To suppress this behavior refer to User Property: license.includedTypes |
<includeOptional> |
boolean |
1.19 |
If true both optional and non-optional dependencies will be included in the list of artifacts for creating the license report; otherwise only non-optional dependencies will be considered.Default: true User Property: license.includeOptional |
<includeTransitiveDependencies> |
boolean |
1.1 |
If true enforces including transitive dependencies of the projects in the reactor; otherwise only direct dependencies of the reactor projects are considered.Default: true User Property: license.includeTransitiveDependencies |
<licenseMerges> |
List<String> |
1.0 |
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>
Note: This option will be overridden by |
<licenseMergesFile> |
String |
1.15 |
Deprecated. The file with the merge licenses in order to be used by command line. Note: This option overrides licenseMerges .User Property: license.licenseMergesFile |
<licenseMergesUrl> |
String |
1.17 |
Location of file with the merge licenses in order to be used by command line. Note: This option overrides licenseMerges .User Property: license.licenseMergesUrl |
<missingFile> |
File |
1.0 |
The file to write with a license information template for dependencies with unknown license. Default: src/license/THIRD-PARTY.properties User Property: license.missingFile |
<missingFileUrl> |
String |
1.15 |
The Url that holds the missing license dependency entries. This is an extension to missingFile . If set then the entries that will be found at this URL will be added additionally to the entries of the missing file.
NOTE: the response of the URL endpoint must return content that matches the THIRD-PARTY.properties file! User Property: license.missingFileUrl |
<missingLicensesFileArtifact> |
String |
1.14 |
To resolve third party licenses from an artifact. User Property: license.missingLicensesFileArtifact |
<overrideFile> |
File |
1.12 |
Deprecated. A file containing the override license information for dependencies. Note: Specify either overrideUrl (preferred) or overrideFile . If none of these is specified, then "src/license/override-THIRD-PARTY.properties" resolved against ${basedir} will be used if it exists.User Property: license.overrideFile |
<overrideUrl> |
String |
1.17 |
A URL pointing at a property file with the override license information for dependencies. Note: Specify either overrideUrl (preferred) or overrideFile . If none of these is specified, then "src/license/override-THIRD-PARTY.properties" resolved against ${basedir} will be used if it exists.
An example of the file content: org.jboss.xnio--xnio-api--3.3.6.Final=The Apache Software License, Version 2.0 User Property: license.overrideUrl |
<skipAddThirdParty> |
boolean |
1.5 |
To skip execution of this mojo. Default: false User Property: license.skipAddThirdParty |
<sortArtifactByName> |
boolean |
1.6 |
A flag to sort artifact by name in the generated third-party file.
If not then artifacts are sorted by groupId:artifactId:version Default: false User Property: license.sortArtifactByName |
<useMissingFile> |
boolean |
1.0 |
A flag to use the missing licenses file to consolidate the THID-PARTY file. Default: false User Property: license.useMissingFile |
<useRepositoryMissingFiles> |
boolean |
1.0 |
Load files supplying information for missing third party licenses from repositories. The plugin looks for Maven artifacts with coordinates of the form G:A:V:properties:third-party, where the group, artifact, and version are those for dependencies of your project, while the type is 'properties' and the classifier is 'third-party'. Default: true User Property: license.useRepositoryMissingFiles |
<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: ${maven.verbose} User Property: license.verbose |
Parameter Details
<acceptPomPackaging>
true
the mojo will be executed for reactor projects having any packaging (including pom
); otherwise the mojo will be executed only for projects that do not have packaging pom
.
Since 1.18, when acceptPomPackaging
is true
, aggregate-add-third-party
mojo is executed also for the Maven session root project - i.e. the one out whose directory the mojo was executed. Before 1.18, when acceptPomPackaging
was true
, aggregate-add-third-party
mojo was iterating over all modules in the reactor but the Maven session root project was skipped.
- Type:
boolean
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.acceptPomPackaging
- Default:
false
<artifactFiltersUrl>
# this is a comment
include gaPattern org\.my-org:my-artifact
include gaPattern org\.other-org:other-artifact
exclude gaPattern org\.yet-anther-org:.*
include scope compile
include scope test
exclude scope system
include type jar
exclude type war
- Type:
java.lang.String
- Since:
1.18
- Required:
report.plugin.goal.no
- User Property:
license.artifactFiltersUrl
<bundleThirdPartyPath>
generateBundle
is on.
Note: This option is not available for pom
module types.
- Type:
java.lang.String
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.bundleThirdPartyPath
- Default:
META-INF/${project.artifactId}-THIRD-PARTY.txt
<deployMissingFile>
- Type:
boolean
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.deployMissingFile
- Default:
true
<encoding>
file.encoding
.- Type:
java.lang.String
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.encoding
- Default:
${project.build.sourceEncoding}
<excludedArtifacts>
^org\.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is excluded its transitive dependencies are not automatically excluded. To enforce this behavior refer to excludeTransitiveDependencies
.
- Type:
java.lang.String
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.excludedArtifacts
<excludedGroups>
^org\.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is excluded its transitive dependencies are not automatically excluded. To enforce this behavior refer to excludeTransitiveDependencies
.
- Type:
java.lang.String
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.excludedGroups
<excludedLicenses>
If a such license is found then build will fail when property failOnBlacklist
is true.
Since version 1.4
, there are three ways to fill this parameter :
- A simple string (separated by
|
), the way to use by property configuration:<excludedLicenses>licenseA|licenseB</excludedLicenses>
or-Dlicense.excludedLicenses=licenseA|licenseB
- A list of string (can only be used in plugin configuration, not via property configuration)
<excludedLicenses> <excludedLicense>licenseA</excludedLicense> <excludedLicense>licenseB</excludedLicense> </excludedLicenses>
- Since version
1.15
a URL that contains a set of license names at the target source (only a single URL is accepted as parameter)<includedLicenses>http://my.license.host.com/my-blacklist</includedLicenses>
the license-list on the given URL is expected to be list with a line-break after every entry e.g.:- The Apache Software License, Version 2.0
- Apache License, Version 2.0
- Bouncy Castle Licence
- MIT License
- Type:
org.codehaus.mojo.license.AbstractAddThirdPartyMojo$ExcludedLicenses
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.excludedLicenses
<excludedScopes>
<excludedScopes>test,provided</excludedScopes>
or -Dlicense.excludedScopes=test,provided
.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is excluded its transitive dependencies are not automatically excluded. To enforce this behavior refer to excludeTransitiveDependencies
.
- Type:
java.lang.String
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.excludedScopes
- Default:
system
<excludedTypes>
<excludedTypes>war,pom</excludedTypes>
or -Dlicense.excludedTypes=was,pom
.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is excluded its transitive dependencies are not automatically excluded. To enforce this behavior refer to excludeTransitiveDependencies
.
- Type:
java.lang.String
- Since:
1.15
- Required:
report.plugin.goal.no
- User Property:
license.excludedTypes
<excludeTransitiveDependencies>
true
enforces excluding transitive dependencies of the excluded artifacts in the reactor; otherwise only artifacts that match exclude filters are excluded.- Type:
boolean
- Since:
1.13
- Required:
report.plugin.goal.no
- User Property:
license.excludeTransitiveDependencies
- Default:
false
<failIfWarning>
failOnMissing
or failOnBlacklist
.- Type:
boolean
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.failIfWarning
- Default:
false
<failOnBlacklist>
- Type:
boolean
- Since:
1.14
- Required:
report.plugin.goal.no
- User Property:
license.failOnBlacklist
- Default:
false
<failOnMissing>
- Type:
boolean
- Since:
1.14
- Required:
report.plugin.goal.no
- User Property:
license.failOnMissing
- Default:
false
<fileTemplate>
(This template uses freemarker).
Note: This property can either point to a file or a resource on the classpath. In case it points to a file and this plugin is used within a sub-module as part of a multi-module build, you need to make this path resolvable, e.g. by prepending basedir
.
- Type:
java.lang.String
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.fileTemplate
- Default:
/org/codehaus/mojo/license/third-party-file.ftl
<force>
- Type:
boolean
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.force
- Default:
false
<generateBundle>
The file will be copied at the bundleThirdPartyPath
location.
- Type:
boolean
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.generateBundle
- Default:
false
<includedArtifacts>
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is included also its transitive dependencies are included. To suppress this behavior refer to includeTransitiveDependencies
.
- Type:
java.lang.String
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.includedArtifacts
<includedGroups>
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is included also its transitive dependencies are included. To suppress this behavior refer to includeTransitiveDependencies
.
- Type:
java.lang.String
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.includedGroups
<includedLicenses>
If this parameter is filled and a license is not in this whitelist
then build will fail when property failOnBlacklist
is true.
Since version 1.4
, there are three ways to fill this parameter :
- A simple string (separated by
|
), the way to use by property configuration:<includedLicenses>licenseA|licenseB</includedLicenses>
or-Dlicense.includedLicenses=licenseA|licenseB
- A list of string (can only be used in plugin configuration, not via property configuration)
<includedLicenses> <includedLicense>licenseA</includedLicense> <includedLicenses>licenseB</includedLicense> </includedLicenses>
- Since version
1.15
a URL that contains a set of license names at the target source (only a single URL is accepted as parameter)<includedLicenses>http://my.license.host.com/my-whitelist</includedLicenses>
the license-list on the given URL is expected to be list with a line-break after every entry e.g.:- The Apache Software License, Version 2.0
- Apache License, Version 2.0
- Bouncy Castle Licence
- MIT License
- Type:
org.codehaus.mojo.license.AbstractAddThirdPartyMojo$IncludedLicenses
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.includedLicenses
<includedScopes>
<includedScopes>test,provided</includedScopes>
or -Dlicense.includedScopes=test,provided
.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is included also its transitive dependencies are included. To suppress this behavior refer to includeTransitiveDependencies
.
- Type:
java.lang.String
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.includedScopes
<includedTypes>
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is included also its transitive dependencies are included. To suppress this behavior refer to includeTransitiveDependencies
.
- Type:
java.lang.String
- Since:
1.15
- Required:
report.plugin.goal.no
- User Property:
license.includedTypes
<includeOptional>
true
both optional and non-optional dependencies will be included in the list of artifacts for creating the license report; otherwise only non-optional dependencies will be considered.- Type:
boolean
- Since:
1.19
- Required:
report.plugin.goal.no
- User Property:
license.includeOptional
- Default:
true
<includeTransitiveDependencies>
true
enforces including transitive dependencies of the projects in the reactor; otherwise only direct dependencies of the reactor projects are considered.- Type:
boolean
- Since:
1.1
- Required:
report.plugin.goal.no
- User Property:
license.includeTransitiveDependencies
- Default:
true
<licenseMerges>
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>
Note: This option will be overridden by licenseMergesUrl
if it is used by command line.
- Type:
java.util.List<java.lang.String>
- Since:
1.0
- Required:
report.plugin.goal.no
<licenseMergesFile>
licenseMergesUrl
licenseMerges
.- Type:
java.lang.String
- Since:
1.15
- Required:
report.plugin.goal.no
- User Property:
license.licenseMergesFile
<licenseMergesUrl>
licenseMerges
.- Type:
java.lang.String
- Since:
1.17
- Required:
report.plugin.goal.no
- User Property:
license.licenseMergesUrl
<missingFile>
- Type:
java.io.File
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.missingFile
- Default:
src/license/THIRD-PARTY.properties
<missingFileUrl>
missingFile
. If set then the entries that will be found at this URL will be added additionally to the entries of the missing file.
NOTE:
the response of the URL endpoint must return content that matches the THIRD-PARTY.properties file!
- Type:
java.lang.String
- Since:
1.15
- Required:
report.plugin.goal.no
- User Property:
license.missingFileUrl
<missingLicensesFileArtifact>
- Type:
java.lang.String
- Since:
1.14
- Required:
report.plugin.goal.no
- User Property:
license.missingLicensesFileArtifact
<outputDirectory>
- Type:
java.io.File
- Since:
1.0
- Required:
report.plugin.goal.yes
- User Property:
license.outputDirectory
- Default:
${project.build.directory}/generated-sources/license
<overrideFile>
overrideUrl
insteadoverrideUrl
(preferred) or overrideFile
. If none of these is specified, then "src/license/override-THIRD-PARTY.properties" resolved against ${basedir}
will be used if it exists.- Type:
java.io.File
- Since:
1.12
- Required:
report.plugin.goal.no
- User Property:
license.overrideFile
<overrideUrl>
overrideUrl
(preferred) or overrideFile
. If none of these is specified, then "src/license/override-THIRD-PARTY.properties" resolved against ${basedir}
will be used if it exists.
An example of the file content:
org.jboss.xnio--xnio-api--3.3.6.Final=The Apache Software License, Version 2.0
- Type:
java.lang.String
- Since:
1.17
- Required:
report.plugin.goal.no
- User Property:
license.overrideUrl
<skipAddThirdParty>
- Type:
boolean
- Since:
1.5
- Required:
report.plugin.goal.no
- User Property:
license.skipAddThirdParty
- Default:
false
<sortArtifactByName>
If not then artifacts are sorted by
groupId:artifactId:version
- Type:
boolean
- Since:
1.6
- Required:
report.plugin.goal.no
- User Property:
license.sortArtifactByName
- Default:
false
<thirdPartyFilename>
- Type:
java.lang.String
- Since:
1.0
- Required:
report.plugin.goal.yes
- User Property:
license.thirdPartyFilename
- Default:
THIRD-PARTY.txt
<useMissingFile>
- Type:
boolean
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.useMissingFile
- Default:
false
<useRepositoryMissingFiles>
- Type:
boolean
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.useRepositoryMissingFiles
- Default:
true
<verbose>
-X
).- Type:
boolean
- Since:
1.0
- Required:
report.plugin.goal.no
- User Property:
license.verbose
- Default:
${maven.verbose}