logo License Maven Plugin

Maven plugin to download and collect license files from project dependencies.

homepage: www.mojohaus.org/license-maven-plugin
fresh index:
last release: 3 years ago, first release: 1 decade ago
packaging: maven-plugin
get this artifact from: central
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
license:add-third-party (phase: generate-resources)

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.

license:aggregate-add-third-party (phase: generate-resources)

This goal forks executions of the add-third-party goal for all the leaf projects of the tree of modules below the point where it is executed. Note that this plugin sets a specific name, 'add-third-party', for the forked executions in the individual projects. From command level, then even though the execution of this goal is named 'default-cli', the forked executions have the name 'add-third-party'. Thus, to use the pluginManagement element of the POM to set options, you have to name the execution 'add-third-party', not 'default-cli'.

license:aggregate-download-licenses (phase: package)

Download the license files of all aggregated dependencies of the current project, and generate a summary file containing a list of all dependencies and their licenses. The license files will be downloaded to {@link AbstractDownloadLicensesMojo#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: {@link AbstractDownloadLicensesMojo#licensesConfigFile} {@link AbstractDownloadLicensesMojo#errorRemedy} {@link AbstractDownloadLicensesMojo#licenseUrlReplacements} {@link AbstractDownloadLicensesMojo#licenseUrlFileNames} Created on 23/05/16.

license:aggregate-third-party-report

Generates a report of all third-parties detected in the module. Created on 22/05/16.

license:check-file-header

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

license:comment-style-list

Displays all the available comment style to box file headers.

license:download-licenses (phase: package)

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 {@link AbstractDownloadLicensesMojo#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: {@link AbstractDownloadLicensesMojo#licensesConfigFile} {@link AbstractDownloadLicensesMojo#errorRemedy} {@link AbstractDownloadLicensesMojo#licenseUrlReplacements} {@link AbstractDownloadLicensesMojo#licenseUrlFileNames}

license:help

Display help information on license-maven-plugin. Call mvn license:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.

license:license-list

Display all available licenses.

license:licenses-xml-insert-versions (phase: package)

Insert versions into a {@code licenses.xml} file that might have been generated by a {@code *download-licenses} mojo with {@code writeVersions} set to {@code false}.

license:remove-file-header

The goal to remove the header on project source files.

license:third-party-report

Generates a report of all third-parties detected in the module.

license:update-file-header

The goal to update (or add) the header on project source files. This goal replace the {@code update-header} goal which can not deal with Copyright. This goal use a specific project file descriptor {@code project.xml} to describe all files to update for a whole project.

license:update-project-license (phase: generate-resources)

Updates (or creates) the main project license file according to the given license defines as {@link #licenseName}. Can also generate a bundled license file (to avoid collision names in class-path). This file is by default generated in {@code META-INF class-path directory}.

Often used code snippets:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>license-maven-plugin</artifactId>
  <configuration>
    <licenseName>bsd_2</licenseName>
    <organizationName>Board of Regents of the University of
Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
Institute of Molecular Cell Biology and Genetics.</organizationName>
    <projectName>SciJava Common shared library for SciJava software.</projectName>
  </configuration>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>license-maven-plugin</artifactId>
  <version>2.0.0</version>
  <configuration>
    <verbose>false</verbose>
    <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
    <canUpdateDescription>false</canUpdateDescription>
    <licenseName>lgpl_v3_apache_v2</licenseName>
    <licenseResolver>file://${maven.multiModuleProjectDirectory}/license</licenseResolver>
    <inceptionYear>2020</inceptionYear>
    <organizationName>Smooks</organizationName>
    <processStartTag>========================LICENSE_START=================================</processStartTag>
    <processEndTag>=========================LICENSE_END==================================</processEndTag>
  </configuration>
  <executions>
    <execution>
      <id>update-file-header</id>
      <goals>
        <goal>update-file-header</goal>
      </goals>
      <phase>process-sources</phase>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>license-maven-plugin</artifactId>
  <configuration>
    <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
    <canUpdateCopyright>true</canUpdateCopyright>
    <canUpdateDescription>true</canUpdateDescription>
    <organizationName>Private</organizationName>
    <licenseName>apache_v2</licenseName>
    <inceptionYear>2015</inceptionYear>
    <roots>
      <root>etc</root>
      <root>src</root>
      <root>scripts</root>
    </roots>
  </configuration>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>license-maven-plugin</artifactId>
  <version>1.0</version>
  <executions>
    <execution>
      <id>add-third-party</id>
      <phase>generate-resources</phase>
      <goals>
        <goal>add-third-party</goal>
      </goals>
    </execution>
    <execution>
      <id>download-licenses</id>
      <goals>
        <goal>download-licenses</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <groupByLicense>true</groupByLicense>
    <excludedScopes>test,provided,system</excludedScopes>
  </configuration>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>license-maven-plugin</artifactId>
  <executions>
    <execution>
      <id>check-file-header</id>
      <phase>process-sources</phase>
      <goals>
        <goal>update-file-header</goal>
        <goal>update-project-license</goal>
      </goals>
    </execution>
  </executions>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.