Fork me on GitHub

license:download-licenses

Full name:

org.codehaus.mojo:license-maven-plugin:2.4.0:download-licenses

Description:

Download the license files of all the current project's dependencies, and generate a summary file containing a list of all dependencies and their licenses.

The license files will be downloaded to licensesOutputDirectory to be included in the final packaging of the project if desired. The licenses are downloaded from the url field of the dependency POM.

If the license information (license name and license URL) is missing or otherwise broken in a dependency POM, this mojo offers several fallback options:

  • licensesConfigFile
  • errorRemedy
  • licenseUrlReplacements
  • licenseUrlFileNames

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Since version: 1.0.
  • Binds by default to the lifecycle phase: package.

Optional Parameters

Name Type Since Description
<artifactFiltersUrl> String 1.18 A URL returning a plain text file that contains include/exclude artifact filters in the following format:
# 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

User Property: license.artifactFiltersUrl
<cleanLicensesOutputDirectory> boolean 1.18 If true, the mojo will delete all files from licensesOutputDirectory and then download them all anew; otherwise the deletion before the download does not happen.

This may be useful if you have removed some dependencies and you want the stale license files to go away. cleanLicensesOutputDirectory = true is not implied by forceDownload because users may have other files there in licensesOutputDirectory that were not downloaded by the plugin.


See also: removeOrphanLicenseFiles
Default: false
User Property: license.cleanLicensesOutputDirectory
<connectionRequestTimeout> int 1.18 Connect request timeout in milliseconds passed to the HTTP client when downloading licenses from remote URLs.
Default: 5000
User Property: license.connectionRequestTimeout
<connectTimeout> int 1.18 Connect timeout in milliseconds passed to the HTTP client when downloading licenses from remote URLs.
Default: 5000
User Property: license.connectTimeout
<errorRemedy> AbstractDownloadLicensesMojo$ErrorRemedy 1.18 What to do on any license download related error. The possible values are:
    • ErrorRemedy#ignore: all errors are ignored
      ErrorRemedy#warn: all errors are output to the log as warnings
      ErrorRemedy#failFast: a org.apache.maven.plugin.MojoFailureException is thrown on the first download related error
      ErrorRemedy#xmlOutput: error messages are added as <downloaderMessages> to licensesErrorsFile; in case there are error messages, the build will fail after processing all dependencies

  • Default: warn
    User Property: license.errorRemedy
    <excludedArtifacts> String 1.11 A filter to exclude some ArtifactsIds This is a regular expression applied to artifactIds.
    User Property: license.excludedArtifacts
    <excludedGroups> String 1.11 A filter to exclude some GroupIds This is a regular expression that is applied to groupIds (not an ant pattern).
    User Property: license.excludedGroups
    <excludedScopes> String 1.0 A filter to exclude some scopes.
    Default: system
    User Property: license.excludedScopes
    <excludedTypes> String 1.15 A filter to exclude some types.
    User Property: license.excludedTypes
    <excludeTransitiveDependencies> boolean 1.13 Exclude transitive dependencies from excluded artifacts.
    Default: false
    User Property: license.excludeTransitiveDependencies
    <forceDownload> boolean 1.18 If true, all encountered dependency license URLs are downloaded, no matter what is there in licensesConfigFile and licensesOutputFile; otherwise licensesConfigFile, licensesOutputFile (eventually persisted from a previous build) and the content of licensesOutputDirectory are considered sources of valid information - i.e. only URLs that do not appear to have been downloaded in the past will be downloaded. If your licensesOutputDirectory contains only license files downloaded by this plugin, you may consider combining forceDownload with setting cleanLicensesOutputDirectory true
    Default: false
    User Property: license.forceDownload
    <includedArtifacts> String 1.11 A filter to include only some ArtifactsIds This is a regular expression applied to artifactIds.
    User Property: license.includedArtifacts
    <includedGroups> String 1.11 A filter to include only some GroupIds This is a regular expression applied to artifactIds.
    User Property: license.includedGroups
    <includedScopes> String 1.0 A filter to include only some scopes, if let empty then all scopes will be used (no filter).
    User Property: license.includedScopes
    <includedTypes> String 1.15 A filter to include only some types, if let empty then all types will be used (no filter).
    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.0 Include transitive dependencies when downloading license files.
    Default: true
    <licenseContentSanitizers> List<LicenseContentSanitizer> 1.20 A list of sanitizers to process the content of license files before storing them locally and before computing their sha1 sums. Useful for removing parts of the content that change over time.

    The content sanitizers are applied in alphabetical order by id.

    Set useDefaultContentSanitizers to true to apply the built-in content sanitizers.

    An example:

    <licenseContentSanitizers>
      <licenseContentSanitizer>
        <id>fedoraproject.org-0</id>
        <urlRegexp>.*fedoraproject\\.org.*</urlRegexp><!-- Apply this sanitizer to URLs that contain fedora.org -->
        <contentRegexp>\"wgRequestId\":\"[^\"]*\"</contentRegexp><!-- wgRequestId value changes with every -->
                                                                 <!-- request so we just remove it -->
        <contentReplacement>\"wgRequestId\":\"\"</contentReplacement>
      </licenseContentSanitizer>
      <licenseContentSanitizer>
        <id>opensource.org-0</id>
        <urlRegexp>.*opensource\\.org.*</urlRegexp><!-- Apply this sanitizer to URLs that contain opensource.org -->
        <contentRegexp>jQuery\\.extend\\(Drupal\\.settings[^\\n]+</contentRegexp><!-- Drupal\\.settings contain -->
                                                                                 <!-- some clutter that changes -->
                                                                                 <!-- often so we just remove it -->
        <contentReplacement></contentReplacement>
      </licenseContentSanitizer>
    </licenseContentSanitizers>
    
    

    See also: useDefaultContentSanitizers
    User Property: license.licenseContentSanitizers
    <licenseMerges> List<String> 2.2.1 To merge licenses in the Excel 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>
    <licensesCalcErrorFile> File 2.4.0 A file containing dependencies whose licenses could not be downloaded for some reason. The format is similar to licensesCalcOutputFile but the entries in licensesCalcErrorFile have <downloaderMessage> elements attached to them. Those should explain what kind of error happened during the processing of the given dependency.
    Default: ${project.build.directory}/generated-resources/licenses-errors.ods
    User Property: license.licensesCalcErrorFile
    <licensesCalcOutputFile> File 2.4.0 The Calc output file used if writeCalcFile is true, containing a mapping between each dependency and its license information. With extended information, if available.
    See also: writeCalcFile, AggregateDownloadLicensesMojo.extendedInfo
    Default: ${project.build.directory}/generated-resources/licenses.ods
    User Property: license.licensesCalcOutputFile
    <licensesConfigFile> File 1.0 A file containing the license data (most notably license names and license URLs) missing in pom.xml files of the dependencies.

    Note that since 1.18, if you set errorRemedy to xmlOutput the format of licensesErrorsFile is the same as the one of licensesConfigFile. So you can use licensesErrorsFile as a base for licensesConfigFile.

    Since 1.18, the format of the file is as follows:

    <licenseSummary>
      <dependencies>
        <dependency>
          <groupId>\Qaopalliance\E</groupId><!-- A regular expression -->
          <artifactId>\Qaopalliance\E</artifactId><!-- A regular expression -->
          <!-- <version>.*</version> A version pattern is optional, .* being the default.
          <matchLicenses>
            <!-- Match a list of licenses with a single entry having name "Public Domain" -->
            <license>
              <name>\QPublic Domain\E</name><!-- A regular expression -->
            </license>
          </matchLicenses>
          <licenses approved="true" /><!-- Leave the matched dependency as is. -->
                                      <!-- In this particular case we approve that code in the Public -->
                                      <!-- Domain does not need any license URL. -->
        </dependency>
        <dependency>
            <groupId>\Qasm\E</groupId>
          <artifactId>\Qasm\E</artifactId>
          <matchLicenses>
            <!-- Match an empty list of licenses -->
          </matchLicenses>
          <!-- Replace the list of licenses in all matching dependencies with the following licenses -->
          <licenses>
            <license>
              <name>BSD 3-Clause ASM</name>
              <url>https://gitlab.ow2.org/asm/asm/raw/ASM_3_1_MVN/LICENSE.txt</url>
            </license>
          </licenses>
        </dependency>
        <dependency>
          <groupId>\Qca.uhn.hapi\E</groupId>
          <artifactId>.*</artifactId>
          <matchLicenses>
            <!-- Match a list of licenses with the following three entries in order: -->
            <license>
              <name>\QHAPI is dual licensed (MPL, GPL)\E</name>
              <comments>\QHAPI is dual licensed under both the Mozilla Public License and the GNU General Public License.\E\s+\QWhat this means is that you may choose to use HAPI under the terms of either license.\E\s+\QYou are both permitted and encouraged to use HAPI, royalty-free, within your applications,\E\s+\Qwhether they are free/open-source or commercial/closed-source, provided you abide by the\E\s+\Qterms of one of the licenses below.\E\s+\QYou are under no obligations to inform the HAPI project about what you are doing with\E\s+\QHAPI, but we would love to hear about it anyway!\E</comments>
            </license>
            <license>
              <name>\QMozilla Public License 1.1\E</name>
              <url>\Qhttp://www.mozilla.org/MPL/MPL-1.1.txt\E</url>
              <file>\Qmozilla public license 1.1 - index.0c5913925d40.txt\E</file>
            </license>
            <license>
              <name>\QGNU General Public License\E</name>
              <url>\Qhttp://www.gnu.org/licenses/gpl.txt\E</url>
              <file>\Qgnu general public license - gpl.txt\E</file>
            </license>
          </matchLicenses>
          <licenses approved="true" /><!-- It is OK that the first entry has no URL -->
        </dependency>
      </dependencies>
    </licenseSummary>
    
    

    Before 1.18 the format was the same as the one of licensesOutputFile and the groupIds and artifactIds were matched as plain text rather than regular expressions. No other elements (incl. versions) were matched at all. Since 1.18 the backwards compatibility is achieved by falling back to plain text matching of groupIds and artifactIds if the given <dependency> does not contain the <matchLicenses> element.

    Relationship to other parameters:

    • License names and license URLs licensesConfigFile is applied before licenseUrlReplacements
    • licenseUrlReplacements are applied before licenseUrlFileNames
    • licenseUrlFileNames have higher precedence than <file> elements in licensesConfigFile
    • licenseUrlFileNames are ignored when organizeLicensesByDependencies is true

    Default: ${project.basedir}/src/license/licenses.xml
    User Property: licensesConfigFile
    <licensesErrorsFile> File 1.18 A file containing dependencies whose licenses could not be downloaded for some reason. The format is similar to licensesOutputFile but the entries in licensesErrorsFile have <downloaderMessage> elements attached to them. Those should explain what kind of error happened during the processing of the given dependency.
    Default: ${project.build.directory}/generated-resources/licenses-errors.xml
    User Property: license.licensesErrorsFile
    <licensesExcelErrorFile> File 2.4.0 A file containing dependencies whose licenses could not be downloaded for some reason. The format is similar to licensesExcelOutputFile but the entries in licensesExcelErrorFile have <downloaderMessage> elements attached to them. Those should explain what kind of error happened during the processing of the given dependency.
    Default: ${project.build.directory}/generated-resources/licenses-errors.xlsx
    User Property: license.licensesExcelErrorFile
    <licensesExcelOutputFile> File 2.4.0 The Excel output file used if writeExcelFile is true, containing a mapping between each dependency and its license information. With extended information, if available.
    See also: writeExcelFile, AggregateDownloadLicensesMojo.extendedInfo
    Default: ${project.build.directory}/generated-resources/licenses.xlsx
    User Property: license.licensesExcelOutputFile
    <licensesOutputDirectory> File 1.0 The directory to which the dependency licenses should be written.
    Default: ${project.build.directory}/generated-resources/licenses
    User Property: licensesOutputDirectory
    <licensesOutputFile> File 1.0 The output file containing a mapping between each dependency and its license information.
    Default: ${project.build.directory}/generated-resources/licenses.xml
    User Property: licensesOutputFile
    <licensesOutputFileEncoding> String 1.17 Encoding used to (1) read the file specified in #licensesConfigFile and (2) write the file specified in licensesOutputFile.
    Default: ${project.build.sourceEncoding}
    User Property: licensesOutputFileEncoding
    <licensesOutputFileEol> Eol 1.17 An end of line constant name denoting the EOL string to use when redering the licenses.xml file. Possible values are LF, CRLF, AUTODETECT and PLATFORM.

    When the value AUTODETECT is used, the mojo will use whatever EOL value is used in the first existing of the following files: #licensesConfigFile, ${basedir}/pom.xml.

    The value PLATFORM is deprecated but still kept for backwards compatibility reasons.


    Default: AUTODETECT
    User Property: licensesOutputFileEol
    <licenseUrlFileNames> Map<String,String> 1.18 A map that helps to select local files names for the content downloaded from license URLs.

    Keys in the map are the local file names. These files will be created under licensesOutputDirectory.

    Values are white space (" \t\n\r") separated lists of regular expressions that will be used to match license URLs. The regular expressions are compiled using java.util.regex.Pattern.CASE_INSENSITIVE. Note that various characters that commonly occur in URLs have special meanings in regular extensions. Therefore, consider using regex quoting as described in java.util.regex.Pattern - e.g. http://example\.com or \Qhttp://example.com\E

    In addition to URL patterns, the list can optionally contain a sha1 checksum of the expected content. This is to ensure that the content delivered by a URL does not change without notice. Note that strict checking of the checksum happens only when forceDownload is true. Otherwise the mojo assumes that the URL -> local name mapping is correct and downloads from the URL only if the local file does not exist.

    A special value-less entry <spdx/> can be used to activate built-in license names that are based on license IDs from https://spdx.org/licenses. The built-in SPDX mappings can be overridden by the subsequent entries. To see which SPDX mappings are built-in, add the <spdx/> entry and run the mojo with debug log level, e.g. using -X or {-Dorg.slf4j.simpleLogger.log.org.codehaus.mojo.license=debug} on the command line.

    An example:

    <licenseUrlFileNames>
      <spdx/><!-- A special element to activate built-in file name entries based on spdx.org license IDs -->
      <bsd-antlr.html>
          sha1:81ffbd1712afe8cdf138b570c0fc9934742c33c1
          https?://(www\.)?antlr\.org/license\.html
      </bsd-antlr.html>
      <cddl-gplv2-ce.txt>
          sha1:534a3fc9ae1076409bb00d01127dbba1e2620e92
          \Qhttps://raw.githubusercontent.com/javaee/activation/master/LICENSE.txt\E
      </cddl-gplv2-ce.txt>
    </licenseUrlFileNames>
    
    

    Relationship to other parameters:

    • License names and license URLs licensesConfigFile is applied before licenseUrlReplacements
    • licenseUrlReplacements are applied before licenseUrlFileNames
    • licenseUrlFileNames have higher precedence than <file> elements in licensesConfigFile
    • licenseUrlFileNames are ignored when organizeLicensesByDependencies is true
    <licenseUrlFileNameSanitizers> List<LicenseUrlReplacement> 1.18 A list of regexp:replacement pairs that should be applied to file names for storing licenses.

    Note that these patterns are not applied to file names defined in licenseUrlFileNames.

    <licenseUrlReplacements> List<LicenseUrlReplacement> 1.17 List of regexps/replacements applied to the license urls prior to download.

    License urls that match a regular expression will be replaced by the corresponding replacement. Replacement is performed with java.util.regex.Matcher#replaceAll(String) java.util.regex.Matcher#replaceAll(String) so you can take advantage of capturing groups to facilitate flexible transformations.

    If the replacement element is omitted, this is equivalent to an empty replacement string.

    The replacements are applied in the same order as they are present in the configuration. The default replacements (that can be activated via useDefaultUrlReplacements) are appended to licenseUrlReplacements

    The id field of LicenseUrlReplacement is optional and is useful only if you want to override some of the default replacements.

    
    <licenseUrlReplacements>
      <licenseUrlReplacement>
        <regexp>\Qhttps://glassfish.java.net/public/CDDL+GPL_1_1.html\E</regexp>
        <replacement>https://oss.oracle.com/licenses/CDDL+GPL-1.1</replacement>
      </licenseUrlReplacement>
      <licenseUrlReplacement>
        <regexp>https://(.*)</regexp><!-- replace https with http -->
        <replacement>http://$1</replacement>
      </licenseUrlReplacement>
      <licenseUrlReplacement>
        <id>github.com-0</id><!-- An optional id to override the default replacement with the same id -->
        <regexp>^https?://github\.com/([^/]+)/([^/]+)/blob/(.*)$</regexp><!-- replace GitHub web UI with raw -->
        <replacement>https://raw.githubusercontent.com/$1/$2/$3</replacement>
      </licenseUrlReplacement>
    </licenseUrlReplacements>
    
    

    Relationship to other parameters:

    • Default URL replacements can be unlocked by setting useDefaultUrlReplacements to true.
    • License names and license URLs licensesConfigFile is applied before licenseUrlReplacements
    • licenseUrlReplacements are applied before licenseUrlFileNames
    • licenseUrlFileNames have higher precedence than <file> elements in licensesConfigFile
    • licenseUrlFileNames are ignored when organizeLicensesByDependencies is true
    <offline> boolean 1.0 Settings offline flag (will not download anything if setted to true).
    Default: ${settings.offline}
    <organizeLicensesByDependencies> boolean 1.9 A flag to organize the licenses by dependencies. When this is done, each dependency will get its full license file, even if already downloaded for another dependency.
    Default: false
    User Property: license.organizeLicensesByDependencies
    <quiet> boolean 1.0 Deprecated. Before 1.18, quiet having value false suppressed any license download related warnings in the log. After 1.18 (incl.), the behavior depends on the value of errorRemedy:
    quiet errorRemedy effective errorRemedy
    true warn ignore
    false warn warn
    true or false ignore ignore
    true or false failFast failFast
    true or false xmlOutput xmlOutput

    Default: false
    <removeOrphanLicenseFiles> boolean 1.19 If true the files referenced from licensesOutputFile before executing the mojo but not referenced from licensesOutputFile after executing the mojo will be deleted; otherwise neither before:after diffing nor any file deletions will happen.

    Compared to cleanLicensesOutputDirectory that removes all files from licensesOutputDirectory before downloading all licenses anew, the removeOrphanLicenseFiles removes only files that are certainly not needed anymore, e.g. due to a removal of a dependency. removeOrphanLicenseFiles thus allows to avoid downloading the license files of dependencies that were downloaded in the past and are still available in licensesOutputDirectory.


    See also: cleanLicensesOutputDirectory
    Default: true
    User Property: license.removeOrphanLicenseFiles
    <skipDownloadLicenses> boolean 1.5 A flag to skip the goal.
    Default: false
    User Property: license.skipDownloadLicenses
    <socketTimeout> int 1.18 Socket timeout in milliseconds passed to the HTTP client when downloading licenses from remote URLs.
    Default: 5000
    User Property: license.socketTimeout
    <sortByGroupIdAndArtifactId> boolean - No description.
    Default: false
    User Property: license.sortByGroupIdAndArtifactId
    <useDefaultContentSanitizers> boolean 1.20 If true the default content sanitizers will be added to the internal java.util.Map of sanitizes before adding licenseContentSanitizers by their id; otherwise the default content sanitizers will not be added to the internal java.util.Map of sanitizes.

    Any individual content sanitizer from the set of default sanitizers can be overriden via licenseContentSanitizers if the same id is used in licenseContentSanitizers.

    To view the list of default content sanitizers, set useDefaultContentSanitizers to true and run the mojo with debug log level, e.g. using -X or {-Dorg.slf4j.simpleLogger.log.org.codehaus.mojo.license=debug} on the command line.


    See also: licenseContentSanitizers
    Default: false
    User Property: license.useDefaultContentSanitizers
    <useDefaultUrlReplacements> boolean 1.20 If true the default license URL replacements be added to the internal java.util.Map of URL replacements before adding licenseUrlReplacements by their id; otherwise the default license URL replacements will not be added to the internal java.util.Map of URL replacements.

    Any individual URL replacement from the set of default URL replacements can be overriden via licenseUrlReplacements if the same id is used in licenseUrlReplacements.

    To view the list of default URL replacements, set useDefaultUrlReplacements to true and run the mojo with debug log level, e.g. using -X or {-Dorg.slf4j.simpleLogger.log.org.codehaus.mojo.license=debug} on the command line.


    See also: licenseUrlReplacements
    Default: false
    User Property: license.useDefaultUrlReplacements
    <writeCalcFile> boolean 2.4.0 Write LibreOffice Calc file (ODS) for goal license:aggregate-download-licenses.
    Default: false
    User Property: license.writeCalcFile
    <writeExcelFile> boolean 2.4.0 Write Microsoft Office Excel file (XLSX) for goal license:aggregate-download-licenses.
    Default: false
    User Property: license.writeExcelFile
    <writeVersions> boolean 1.18 If true, licensesOutputFile and licensesErrorsFile will contain <version> elements for each <dependency>; otherwise the <version> licensesOutputFile and licensesErrorsFile elements will not be appended under <dependency> elements in Might be useful if you want to keep the licensesOutputFile under source control and you do not want to see the changing dependency versions there.
    Default: true
    User Property: license.writeVersions

    Parameter Details

    <artifactFiltersUrl>

    A URL returning a plain text file that contains include/exclude artifact filters in the following format:
    # 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

    <cleanLicensesOutputDirectory>

    If true, the mojo will delete all files from licensesOutputDirectory and then download them all anew; otherwise the deletion before the download does not happen.

    This may be useful if you have removed some dependencies and you want the stale license files to go away. cleanLicensesOutputDirectory = true is not implied by forceDownload because users may have other files there in licensesOutputDirectory that were not downloaded by the plugin.


    See also: removeOrphanLicenseFiles
    • Type: boolean
    • Since: 1.18
    • Required: report.plugin.goal.no
    • User Property: license.cleanLicensesOutputDirectory
    • Default: false

    <connectionRequestTimeout>

    Connect request timeout in milliseconds passed to the HTTP client when downloading licenses from remote URLs.
    • Type: int
    • Since: 1.18
    • Required: report.plugin.goal.no
    • User Property: license.connectionRequestTimeout
    • Default: 5000

    <connectTimeout>

    Connect timeout in milliseconds passed to the HTTP client when downloading licenses from remote URLs.
    • Type: int
    • Since: 1.18
    • Required: report.plugin.goal.no
    • User Property: license.connectTimeout
    • Default: 5000

    <errorRemedy>

    What to do on any license download related error. The possible values are:
    • ErrorRemedy#ignore: all errors are ignored
      ErrorRemedy#warn: all errors are output to the log as warnings
      ErrorRemedy#failFast: a org.apache.maven.plugin.MojoFailureException is thrown on the first download related error
      ErrorRemedy#xmlOutput: error messages are added as <downloaderMessages> to licensesErrorsFile; in case there are error messages, the build will fail after processing all dependencies
    • Type: org.codehaus.mojo.license.AbstractDownloadLicensesMojo$ErrorRemedy
    • Since: 1.18
    • Required: report.plugin.goal.no
    • User Property: license.errorRemedy
    • Default: warn

    <excludedArtifacts>

    A filter to exclude some ArtifactsIds This is a regular expression applied to artifactIds.
    • Type: java.lang.String
    • Since: 1.11
    • Required: report.plugin.goal.no
    • User Property: license.excludedArtifacts

    <excludedGroups>

    A filter to exclude some GroupIds This is a regular expression that is applied to groupIds (not an ant pattern).
    • Type: java.lang.String
    • Since: 1.11
    • Required: report.plugin.goal.no
    • User Property: license.excludedGroups

    <excludedScopes>

    A filter to exclude some scopes.
    • Type: java.lang.String
    • Since: 1.0
    • Required: report.plugin.goal.no
    • User Property: license.excludedScopes
    • Default: system

    <excludedTypes>

    A filter to exclude some types.
    • Type: java.lang.String
    • Since: 1.15
    • Required: report.plugin.goal.no
    • User Property: license.excludedTypes

    <excludeTransitiveDependencies>

    Exclude transitive dependencies from excluded artifacts.
    • Type: boolean
    • Since: 1.13
    • Required: report.plugin.goal.no
    • User Property: license.excludeTransitiveDependencies
    • Default: false

    <forceDownload>

    If true, all encountered dependency license URLs are downloaded, no matter what is there in licensesConfigFile and licensesOutputFile; otherwise licensesConfigFile, licensesOutputFile (eventually persisted from a previous build) and the content of licensesOutputDirectory are considered sources of valid information - i.e. only URLs that do not appear to have been downloaded in the past will be downloaded. If your licensesOutputDirectory contains only license files downloaded by this plugin, you may consider combining forceDownload with setting cleanLicensesOutputDirectory true
    • Type: boolean
    • Since: 1.18
    • Required: report.plugin.goal.no
    • User Property: license.forceDownload
    • Default: false

    <includedArtifacts>

    A filter to include only some ArtifactsIds This is a regular expression applied to artifactIds.
    • Type: java.lang.String
    • Since: 1.11
    • Required: report.plugin.goal.no
    • User Property: license.includedArtifacts

    <includedGroups>

    A filter to include only some GroupIds This is a regular expression applied to artifactIds.
    • Type: java.lang.String
    • Since: 1.11
    • Required: report.plugin.goal.no
    • User Property: license.includedGroups

    <includedScopes>

    A filter to include only some scopes, if let empty then all scopes will be used (no filter).
    • Type: java.lang.String
    • Since: 1.0
    • Required: report.plugin.goal.no
    • User Property: license.includedScopes

    <includedTypes>

    A filter to include only some types, if let empty then all types will be used (no filter).
    • Type: java.lang.String
    • Since: 1.15
    • Required: report.plugin.goal.no
    • User Property: license.includedTypes

    <includeOptional>

    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.
    • Type: boolean
    • Since: 1.19
    • Required: report.plugin.goal.no
    • User Property: license.includeOptional
    • Default: true

    <includeTransitiveDependencies>

    Include transitive dependencies when downloading license files.
    • Type: boolean
    • Since: 1.0
    • Required: report.plugin.goal.no
    • Default: true

    <licenseContentSanitizers>

    A list of sanitizers to process the content of license files before storing them locally and before computing their sha1 sums. Useful for removing parts of the content that change over time.

    The content sanitizers are applied in alphabetical order by id.

    Set useDefaultContentSanitizers to true to apply the built-in content sanitizers.

    An example:

    <licenseContentSanitizers>
      <licenseContentSanitizer>
        <id>fedoraproject.org-0</id>
        <urlRegexp>.*fedoraproject\\.org.*</urlRegexp><!-- Apply this sanitizer to URLs that contain fedora.org -->
        <contentRegexp>\"wgRequestId\":\"[^\"]*\"</contentRegexp><!-- wgRequestId value changes with every -->
                                                                 <!-- request so we just remove it -->
        <contentReplacement>\"wgRequestId\":\"\"</contentReplacement>
      </licenseContentSanitizer>
      <licenseContentSanitizer>
        <id>opensource.org-0</id>
        <urlRegexp>.*opensource\\.org.*</urlRegexp><!-- Apply this sanitizer to URLs that contain opensource.org -->
        <contentRegexp>jQuery\\.extend\\(Drupal\\.settings[^\\n]+</contentRegexp><!-- Drupal\\.settings contain -->
                                                                                 <!-- some clutter that changes -->
                                                                                 <!-- often so we just remove it -->
        <contentReplacement></contentReplacement>
      </licenseContentSanitizer>
    </licenseContentSanitizers>
    
    

    See also: useDefaultContentSanitizers
    • Type: java.util.List<org.codehaus.mojo.license.LicenseContentSanitizer>
    • Since: 1.20
    • Required: report.plugin.goal.no
    • User Property: license.licenseContentSanitizers

    <licenseMerges>

    To merge licenses in the Excel 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>
    • Type: java.util.List<java.lang.String>
    • Since: 2.2.1
    • Required: report.plugin.goal.no

    <licensesCalcErrorFile>

    A file containing dependencies whose licenses could not be downloaded for some reason. The format is similar to licensesCalcOutputFile but the entries in licensesCalcErrorFile have <downloaderMessage> elements attached to them. Those should explain what kind of error happened during the processing of the given dependency.
    • Type: java.io.File
    • Since: 2.4.0
    • Required: report.plugin.goal.no
    • User Property: license.licensesCalcErrorFile
    • Default: ${project.build.directory}/generated-resources/licenses-errors.ods

    <licensesCalcOutputFile>

    The Calc output file used if writeCalcFile is true, containing a mapping between each dependency and its license information. With extended information, if available.
    See also: writeCalcFile, AggregateDownloadLicensesMojo.extendedInfo
    • Type: java.io.File
    • Since: 2.4.0
    • Required: report.plugin.goal.no
    • User Property: license.licensesCalcOutputFile
    • Default: ${project.build.directory}/generated-resources/licenses.ods

    <licensesConfigFile>

    A file containing the license data (most notably license names and license URLs) missing in pom.xml files of the dependencies.

    Note that since 1.18, if you set errorRemedy to xmlOutput the format of licensesErrorsFile is the same as the one of licensesConfigFile. So you can use licensesErrorsFile as a base for licensesConfigFile.

    Since 1.18, the format of the file is as follows:

    <licenseSummary>
      <dependencies>
        <dependency>
          <groupId>\Qaopalliance\E</groupId><!-- A regular expression -->
          <artifactId>\Qaopalliance\E</artifactId><!-- A regular expression -->
          <!-- <version>.*</version> A version pattern is optional, .* being the default.
          <matchLicenses>
            <!-- Match a list of licenses with a single entry having name "Public Domain" -->
            <license>
              <name>\QPublic Domain\E</name><!-- A regular expression -->
            </license>
          </matchLicenses>
          <licenses approved="true" /><!-- Leave the matched dependency as is. -->
                                      <!-- In this particular case we approve that code in the Public -->
                                      <!-- Domain does not need any license URL. -->
        </dependency>
        <dependency>
            <groupId>\Qasm\E</groupId>
          <artifactId>\Qasm\E</artifactId>
          <matchLicenses>
            <!-- Match an empty list of licenses -->
          </matchLicenses>
          <!-- Replace the list of licenses in all matching dependencies with the following licenses -->
          <licenses>
            <license>
              <name>BSD 3-Clause ASM</name>
              <url>https://gitlab.ow2.org/asm/asm/raw/ASM_3_1_MVN/LICENSE.txt</url>
            </license>
          </licenses>
        </dependency>
        <dependency>
          <groupId>\Qca.uhn.hapi\E</groupId>
          <artifactId>.*</artifactId>
          <matchLicenses>
            <!-- Match a list of licenses with the following three entries in order: -->
            <license>
              <name>\QHAPI is dual licensed (MPL, GPL)\E</name>
              <comments>\QHAPI is dual licensed under both the Mozilla Public License and the GNU General Public License.\E\s+\QWhat this means is that you may choose to use HAPI under the terms of either license.\E\s+\QYou are both permitted and encouraged to use HAPI, royalty-free, within your applications,\E\s+\Qwhether they are free/open-source or commercial/closed-source, provided you abide by the\E\s+\Qterms of one of the licenses below.\E\s+\QYou are under no obligations to inform the HAPI project about what you are doing with\E\s+\QHAPI, but we would love to hear about it anyway!\E</comments>
            </license>
            <license>
              <name>\QMozilla Public License 1.1\E</name>
              <url>\Qhttp://www.mozilla.org/MPL/MPL-1.1.txt\E</url>
              <file>\Qmozilla public license 1.1 - index.0c5913925d40.txt\E</file>
            </license>
            <license>
              <name>\QGNU General Public License\E</name>
              <url>\Qhttp://www.gnu.org/licenses/gpl.txt\E</url>
              <file>\Qgnu general public license - gpl.txt\E</file>
            </license>
          </matchLicenses>
          <licenses approved="true" /><!-- It is OK that the first entry has no URL -->
        </dependency>
      </dependencies>
    </licenseSummary>
    
    

    Before 1.18 the format was the same as the one of licensesOutputFile and the groupIds and artifactIds were matched as plain text rather than regular expressions. No other elements (incl. versions) were matched at all. Since 1.18 the backwards compatibility is achieved by falling back to plain text matching of groupIds and artifactIds if the given <dependency> does not contain the <matchLicenses> element.

    Relationship to other parameters:

    • License names and license URLs licensesConfigFile is applied before licenseUrlReplacements
    • licenseUrlReplacements are applied before licenseUrlFileNames
    • licenseUrlFileNames have higher precedence than <file> elements in licensesConfigFile
    • licenseUrlFileNames are ignored when organizeLicensesByDependencies is true
    • Type: java.io.File
    • Since: 1.0
    • Required: report.plugin.goal.no
    • User Property: licensesConfigFile
    • Default: ${project.basedir}/src/license/licenses.xml

    <licensesErrorsFile>

    A file containing dependencies whose licenses could not be downloaded for some reason. The format is similar to licensesOutputFile but the entries in licensesErrorsFile have <downloaderMessage> elements attached to them. Those should explain what kind of error happened during the processing of the given dependency.
    • Type: java.io.File
    • Since: 1.18
    • Required: report.plugin.goal.no
    • User Property: license.licensesErrorsFile
    • Default: ${project.build.directory}/generated-resources/licenses-errors.xml

    <licensesExcelErrorFile>

    A file containing dependencies whose licenses could not be downloaded for some reason. The format is similar to licensesExcelOutputFile but the entries in licensesExcelErrorFile have <downloaderMessage> elements attached to them. Those should explain what kind of error happened during the processing of the given dependency.
    • Type: java.io.File
    • Since: 2.4.0
    • Required: report.plugin.goal.no
    • User Property: license.licensesExcelErrorFile
    • Default: ${project.build.directory}/generated-resources/licenses-errors.xlsx

    <licensesExcelOutputFile>

    The Excel output file used if writeExcelFile is true, containing a mapping between each dependency and its license information. With extended information, if available.
    See also: writeExcelFile, AggregateDownloadLicensesMojo.extendedInfo
    • Type: java.io.File
    • Since: 2.4.0
    • Required: report.plugin.goal.no
    • User Property: license.licensesExcelOutputFile
    • Default: ${project.build.directory}/generated-resources/licenses.xlsx

    <licensesOutputDirectory>

    The directory to which the dependency licenses should be written.
    • Type: java.io.File
    • Since: 1.0
    • Required: report.plugin.goal.no
    • User Property: licensesOutputDirectory
    • Default: ${project.build.directory}/generated-resources/licenses

    <licensesOutputFile>

    The output file containing a mapping between each dependency and its license information.
    • Type: java.io.File
    • Since: 1.0
    • Required: report.plugin.goal.no
    • User Property: licensesOutputFile
    • Default: ${project.build.directory}/generated-resources/licenses.xml

    <licensesOutputFileEncoding>

    Encoding used to (1) read the file specified in #licensesConfigFile and (2) write the file specified in licensesOutputFile.
    • Type: java.lang.String
    • Since: 1.17
    • Required: report.plugin.goal.no
    • User Property: licensesOutputFileEncoding
    • Default: ${project.build.sourceEncoding}

    <licensesOutputFileEol>

    An end of line constant name denoting the EOL string to use when redering the licenses.xml file. Possible values are LF, CRLF, AUTODETECT and PLATFORM.

    When the value AUTODETECT is used, the mojo will use whatever EOL value is used in the first existing of the following files: #licensesConfigFile, ${basedir}/pom.xml.

    The value PLATFORM is deprecated but still kept for backwards compatibility reasons.

    • Type: org.codehaus.mojo.license.Eol
    • Since: 1.17
    • Required: report.plugin.goal.no
    • User Property: licensesOutputFileEol
    • Default: AUTODETECT

    <licenseUrlFileNames>

    A map that helps to select local files names for the content downloaded from license URLs.

    Keys in the map are the local file names. These files will be created under licensesOutputDirectory.

    Values are white space (" \t\n\r") separated lists of regular expressions that will be used to match license URLs. The regular expressions are compiled using java.util.regex.Pattern.CASE_INSENSITIVE. Note that various characters that commonly occur in URLs have special meanings in regular extensions. Therefore, consider using regex quoting as described in java.util.regex.Pattern - e.g. http://example\.com or \Qhttp://example.com\E

    In addition to URL patterns, the list can optionally contain a sha1 checksum of the expected content. This is to ensure that the content delivered by a URL does not change without notice. Note that strict checking of the checksum happens only when forceDownload is true. Otherwise the mojo assumes that the URL -> local name mapping is correct and downloads from the URL only if the local file does not exist.

    A special value-less entry <spdx/> can be used to activate built-in license names that are based on license IDs from https://spdx.org/licenses. The built-in SPDX mappings can be overridden by the subsequent entries. To see which SPDX mappings are built-in, add the <spdx/> entry and run the mojo with debug log level, e.g. using -X or {-Dorg.slf4j.simpleLogger.log.org.codehaus.mojo.license=debug} on the command line.

    An example:

    <licenseUrlFileNames>
      <spdx/><!-- A special element to activate built-in file name entries based on spdx.org license IDs -->
      <bsd-antlr.html>
          sha1:81ffbd1712afe8cdf138b570c0fc9934742c33c1
          https?://(www\.)?antlr\.org/license\.html
      </bsd-antlr.html>
      <cddl-gplv2-ce.txt>
          sha1:534a3fc9ae1076409bb00d01127dbba1e2620e92
          \Qhttps://raw.githubusercontent.com/javaee/activation/master/LICENSE.txt\E
      </cddl-gplv2-ce.txt>
    </licenseUrlFileNames>
    
    

    Relationship to other parameters:

    • License names and license URLs licensesConfigFile is applied before licenseUrlReplacements
    • licenseUrlReplacements are applied before licenseUrlFileNames
    • licenseUrlFileNames have higher precedence than <file> elements in licensesConfigFile
    • licenseUrlFileNames are ignored when organizeLicensesByDependencies is true
    • Type: java.util.Map<java.lang.String, java.lang.String>
    • Since: 1.18
    • Required: report.plugin.goal.no

    <licenseUrlFileNameSanitizers>

    A list of regexp:replacement pairs that should be applied to file names for storing licenses.

    Note that these patterns are not applied to file names defined in licenseUrlFileNames.

    • Type: java.util.List<org.codehaus.mojo.license.LicenseUrlReplacement>
    • Since: 1.18
    • Required: report.plugin.goal.no

    <licenseUrlReplacements>

    List of regexps/replacements applied to the license urls prior to download.

    License urls that match a regular expression will be replaced by the corresponding replacement. Replacement is performed with java.util.regex.Matcher#replaceAll(String) java.util.regex.Matcher#replaceAll(String) so you can take advantage of capturing groups to facilitate flexible transformations.

    If the replacement element is omitted, this is equivalent to an empty replacement string.

    The replacements are applied in the same order as they are present in the configuration. The default replacements (that can be activated via useDefaultUrlReplacements) are appended to licenseUrlReplacements

    The id field of LicenseUrlReplacement is optional and is useful only if you want to override some of the default replacements.

    
    <licenseUrlReplacements>
      <licenseUrlReplacement>
        <regexp>\Qhttps://glassfish.java.net/public/CDDL+GPL_1_1.html\E</regexp>
        <replacement>https://oss.oracle.com/licenses/CDDL+GPL-1.1</replacement>
      </licenseUrlReplacement>
      <licenseUrlReplacement>
        <regexp>https://(.*)</regexp><!-- replace https with http -->
        <replacement>http://$1</replacement>
      </licenseUrlReplacement>
      <licenseUrlReplacement>
        <id>github.com-0</id><!-- An optional id to override the default replacement with the same id -->
        <regexp>^https?://github\.com/([^/]+)/([^/]+)/blob/(.*)$</regexp><!-- replace GitHub web UI with raw -->
        <replacement>https://raw.githubusercontent.com/$1/$2/$3</replacement>
      </licenseUrlReplacement>
    </licenseUrlReplacements>
    
    

    Relationship to other parameters:

    • Default URL replacements can be unlocked by setting useDefaultUrlReplacements to true.
    • License names and license URLs licensesConfigFile is applied before licenseUrlReplacements
    • licenseUrlReplacements are applied before licenseUrlFileNames
    • licenseUrlFileNames have higher precedence than <file> elements in licensesConfigFile
    • licenseUrlFileNames are ignored when organizeLicensesByDependencies is true
    • Type: java.util.List<org.codehaus.mojo.license.LicenseUrlReplacement>
    • Since: 1.17
    • Required: report.plugin.goal.no

    <offline>

    Settings offline flag (will not download anything if setted to true).
    • Type: boolean
    • Since: 1.0
    • Required: report.plugin.goal.no
    • Default: ${settings.offline}

    <organizeLicensesByDependencies>

    A flag to organize the licenses by dependencies. When this is done, each dependency will get its full license file, even if already downloaded for another dependency.
    • Type: boolean
    • Since: 1.9
    • Required: report.plugin.goal.no
    • User Property: license.organizeLicensesByDependencies
    • Default: false

    <quiet>

    Deprecated. Use errorRemedy instead
    Before 1.18, quiet having value false suppressed any license download related warnings in the log. After 1.18 (incl.), the behavior depends on the value of errorRemedy:
    quiet errorRemedy effective errorRemedy
    true warn ignore
    false warn warn
    true or false ignore ignore
    true or false failFast failFast
    true or false xmlOutput xmlOutput
    • Type: boolean
    • Since: 1.0
    • Required: report.plugin.goal.no
    • Default: false

    <removeOrphanLicenseFiles>

    If true the files referenced from licensesOutputFile before executing the mojo but not referenced from licensesOutputFile after executing the mojo will be deleted; otherwise neither before:after diffing nor any file deletions will happen.

    Compared to cleanLicensesOutputDirectory that removes all files from licensesOutputDirectory before downloading all licenses anew, the removeOrphanLicenseFiles removes only files that are certainly not needed anymore, e.g. due to a removal of a dependency. removeOrphanLicenseFiles thus allows to avoid downloading the license files of dependencies that were downloaded in the past and are still available in licensesOutputDirectory.


    See also: cleanLicensesOutputDirectory
    • Type: boolean
    • Since: 1.19
    • Required: report.plugin.goal.no
    • User Property: license.removeOrphanLicenseFiles
    • Default: true

    <skipDownloadLicenses>

    A flag to skip the goal.
    • Type: boolean
    • Since: 1.5
    • Required: report.plugin.goal.no
    • User Property: license.skipDownloadLicenses
    • Default: false

    <socketTimeout>

    Socket timeout in milliseconds passed to the HTTP client when downloading licenses from remote URLs.
    • Type: int
    • Since: 1.18
    • Required: report.plugin.goal.no
    • User Property: license.socketTimeout
    • Default: 5000

    <sortByGroupIdAndArtifactId>

    No description.
    • Type: boolean
    • Required: report.plugin.goal.no
    • User Property: license.sortByGroupIdAndArtifactId
    • Default: false

    <useDefaultContentSanitizers>

    If true the default content sanitizers will be added to the internal java.util.Map of sanitizes before adding licenseContentSanitizers by their id; otherwise the default content sanitizers will not be added to the internal java.util.Map of sanitizes.

    Any individual content sanitizer from the set of default sanitizers can be overriden via licenseContentSanitizers if the same id is used in licenseContentSanitizers.

    To view the list of default content sanitizers, set useDefaultContentSanitizers to true and run the mojo with debug log level, e.g. using -X or {-Dorg.slf4j.simpleLogger.log.org.codehaus.mojo.license=debug} on the command line.


    See also: licenseContentSanitizers
    • Type: boolean
    • Since: 1.20
    • Required: report.plugin.goal.no
    • User Property: license.useDefaultContentSanitizers
    • Default: false

    <useDefaultUrlReplacements>

    If true the default license URL replacements be added to the internal java.util.Map of URL replacements before adding licenseUrlReplacements by their id; otherwise the default license URL replacements will not be added to the internal java.util.Map of URL replacements.

    Any individual URL replacement from the set of default URL replacements can be overriden via licenseUrlReplacements if the same id is used in licenseUrlReplacements.

    To view the list of default URL replacements, set useDefaultUrlReplacements to true and run the mojo with debug log level, e.g. using -X or {-Dorg.slf4j.simpleLogger.log.org.codehaus.mojo.license=debug} on the command line.


    See also: licenseUrlReplacements
    • Type: boolean
    • Since: 1.20
    • Required: report.plugin.goal.no
    • User Property: license.useDefaultUrlReplacements
    • Default: false

    <writeCalcFile>

    Write LibreOffice Calc file (ODS) for goal license:aggregate-download-licenses.
    • Type: boolean
    • Since: 2.4.0
    • Required: report.plugin.goal.no
    • User Property: license.writeCalcFile
    • Default: false

    <writeExcelFile>

    Write Microsoft Office Excel file (XLSX) for goal license:aggregate-download-licenses.
    • Type: boolean
    • Since: 2.4.0
    • Required: report.plugin.goal.no
    • User Property: license.writeExcelFile
    • Default: false

    <writeVersions>

    If true, licensesOutputFile and licensesErrorsFile will contain <version> elements for each <dependency>; otherwise the <version> licensesOutputFile and licensesErrorsFile elements will not be appended under <dependency> elements in Might be useful if you want to keep the licensesOutputFile under source control and you do not want to see the changing dependency versions there.
    • Type: boolean
    • Since: 1.18
    • Required: report.plugin.goal.no
    • User Property: license.writeVersions
    • Default: true