license:add-third-party
Full name:
org.codehaus.mojo:license-maven-plugin:2.7.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/licenseUser Property: license.outputDirectory | 
| <thirdPartyFilename> | String | 1.0 | File where to write the third-party file. Default: THIRD-PARTY.txtUser Property: license.thirdPartyFilename | 
Optional Parameters
| Name | Type | Since | Description | 
|---|---|---|---|
| <acceptPomPackaging> | boolean | 1.1 | If truethe mojo will be executed for reactor projects having any packaging (includingpom); otherwise the mojo will be executed only for projects that do not have packagingpom.Since 1.18, when  Default: falseUser Property: license.acceptPomPackaging | 
| <addOutputDirectoryAsResourceDir> | boolean | 2.5.0 | Add the output directory as resource directory. If this is set to  Default: trueUser Property: license.addOutputDirectoryAsResourceDir | 
| <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 generateBundleis on.Note: This option is not available for  Default: META-INF/${project.artifactId}-THIRD-PARTY.txtUser 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: trueUser 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 | 
| <excludeTransitiveDependencies> | boolean | 1.13 | If trueenforces excluding transitive dependencies of the excluded artifacts in the reactor; otherwise only artifacts that match exclude filters are excluded.Default: falseUser Property: license.excludeTransitiveDependencies | 
| <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: systemUser 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 | 
| <failIfWarning> | boolean | 1.0 | Deprecated. since 1.14, use now failOnMissingorfailOnBlacklist.A flag to fail the build if at least one dependency was detected without a license. Default: falseUser Property: license.failIfWarning | 
| <failOnBlacklist> | boolean | 1.14 | A flag to fail the build if at least one dependency was blacklisted. Default: falseUser Property: license.failOnBlacklist | 
| <failOnMissing> | boolean | 1.14 | A flag to fail the build if at least one dependency was detected without a license. Default: falseUser 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.ftlUser Property: license.fileTemplate | 
| <force> | boolean | 1.0 | To force generation of the third-party file even if everything is up to date. Default: falseUser 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: falseUser Property: license.generateBundle | 
| <includeOptional> | boolean | 1.19 | If trueboth 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: trueUser Property: license.includeOptional | 
| <includeTransitiveDependencies> | boolean | 1.1 | If trueenforces including transitive dependencies of the projects in the reactor; otherwise only direct dependencies of the reactor projects are considered.Default: trueUser Property: license.includeTransitiveDependencies | 
| <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 | 
| <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. prefer use now licenseMergesUrlThe 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.propertiesUser 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. Use overrideUrlinsteadA file containing the override license information for dependencies. Note: Specify either overrideUrl(preferred) oroverrideFile. 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) oroverrideFile. 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: falseUser 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: falseUser Property: license.sortArtifactByName | 
| <useMissingFile> | boolean | 1.0 | A flag to use the missing licenses file to consolidate the THID-PARTY file. Default: falseUser 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: trueUser 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: No
- User Property: license.acceptPomPackaging
- Default: false
<addOutputDirectoryAsResourceDir>
If this is set to false the generated files are no longer added automatically to the final artifact.
- Type: boolean
- Since: 2.5.0
- Required: No
- User Property: license.addOutputDirectoryAsResourceDir
- Default: true
<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: 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: No
- User Property: license.bundleThirdPartyPath
- Default: META-INF/${project.artifactId}-THIRD-PARTY.txt
<deployMissingFile>
- Type: boolean
- Since: 1.0
- Required: No
- User Property: license.deployMissingFile
- Default: true
<encoding>
file.encoding.- Type: java.lang.String
- Since: 1.0
- Required: No
- User Property: license.encoding
- Default: ${project.build.sourceEncoding}
<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: No
- User Property: license.excludeTransitiveDependencies
- Default: false
<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: 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: 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: 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: 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: No
- User Property: license.excludedTypes
<failIfWarning>
since 1.14, use now
failOnMissing or failOnBlacklist.- Type: boolean
- Since: 1.0
- Required: No
- User Property: license.failIfWarning
- Default: false
<failOnBlacklist>
- Type: boolean
- Since: 1.14
- Required: No
- User Property: license.failOnBlacklist
- Default: false
<failOnMissing>
- Type: boolean
- Since: 1.14
- Required: 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: No
- User Property: license.fileTemplate
- Default: /org/codehaus/mojo/license/third-party-file.ftl
<force>
- Type: boolean
- Since: 1.0
- Required: No
- User Property: license.force
- Default: false
<generateBundle>
The file will be copied at the bundleThirdPartyPath location.
- Type: boolean
- Since: 1.0
- Required: No
- User Property: license.generateBundle
- Default: false
<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: 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: No
- User Property: license.includeTransitiveDependencies
- Default: true
<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: 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: 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: 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: 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: No
- User Property: license.includedTypes
<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: No
<licenseMergesFile>
prefer use now
licenseMergesUrllicenseMerges.- Type: java.lang.String
- Since: 1.15
- Required: No
- User Property: license.licenseMergesFile
<licenseMergesUrl>
licenseMerges.- Type: java.lang.String
- Since: 1.17
- Required: No
- User Property: license.licenseMergesUrl
<missingFile>
- Type: java.io.File
- Since: 1.0
- Required: 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: No
- User Property: license.missingFileUrl
<missingLicensesFileArtifact>
- Type: java.lang.String
- Since: 1.14
- Required: No
- User Property: license.missingLicensesFileArtifact
<outputDirectory>
- Type: java.io.File
- Since: 1.0
- Required: Yes
- User Property: license.outputDirectory
- Default: ${project.build.directory}/generated-sources/license
<overrideFile>
Use
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: 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: No
- User Property: license.overrideUrl
<skipAddThirdParty>
- Type: boolean
- Since: 1.5
- Required: No
- User Property: license.skipAddThirdParty
- Default: false
<sortArtifactByName>
If not then artifacts are sorted by
groupId:artifactId:version
- Type: boolean
- Since: 1.6
- Required: No
- User Property: license.sortArtifactByName
- Default: false
<thirdPartyFilename>
- Type: java.lang.String
- Since: 1.0
- Required: Yes
- User Property: license.thirdPartyFilename
- Default: THIRD-PARTY.txt
<useMissingFile>
- Type: boolean
- Since: 1.0
- Required: No
- User Property: license.useMissingFile
- Default: false
<useRepositoryMissingFiles>
- Type: boolean
- Since: 1.0
- Required: No
- User Property: license.useRepositoryMissingFiles
- Default: true
<verbose>
-X).- Type: boolean
- Since: 1.0
- Required: No
- User Property: license.verbose
- Default: ${maven.verbose}

