Usage
The License Maven Plugin provides several goals related to licenses in a project. This includes validating/updating license header information in source files, updating the LICENSE.txt file, and retrieving license information from dependencies. The information below should help you to get started. If you have problems using the plugin, please feel free to post your questions to the user mailing list.
Getting Plugin Configuration Information
license-list goal
This goal displays a list of available licenses.
Use it directly (and only) from commandline :
mvn license:license-list
To display the license header, use the detail parameter :
mvn license:license-list -Ddetail
For more information, see the examples and for full detail see detail page.
comment-style-list goal
This goal displays the available comment styles to box file header.
Use it directly (and only) from commandline :
mvn license:comment-style-list
To display the example, use the detail parameter :
mvn license:comment-style-list -Ddetail
For more information, see the examples and for full detail see detail page.
help goal
This goal display the help of the plugin (available goals).
Use it directly (and only) from commandline :
mvn license:help
To display verbose help :
mvn license:help -Ddetail
for full detail see detail page.
Updating and checking License Information
update-project-license goal
This goal creates or updates the LICENSE.txt file and adds it in the build.
It can also generate a bundle License file to avoid name collision in a final application.
For full detail see detail page.
update-file-header goal
This goal adds or updates the license header based on the configuration.
For more information, see the examples and for full detail on the configuration see detail page.
check-file-header goal
This goal checks the license header based on the configuration on project sources files.
For full detail see detail page.
This goal has same behaviour as the update-file-header with dryRun option.
Getting Dependency License Information
add-third-party goal
This goal builds the THIRD-PARTY.txt file and adds it in the build.
We are also able to consolidate the generated file by filling another file (the missing file) for dependencies without license.
Note: This mojo has no effect on a pom project.
For more information, see the examples and for full details see the add third party mojo page.
aggregate-add-third-party goal
This goal builds the THIRD-PARTY.txt file on a multi-module project from the dependencies of all its modules.
Note: This mojo only has effect on a pom project.
For more information, see the examples and for full detail see the aggregate add third party mojo page.
download-licenses goal
The License Maven Plugin can download dependency license files and generate an XML report of the licenses. Example configuration is listed below, and more information is available in the examples page.
By default the plugin attaches to the generate-resources
phase of the build lifecycle.
<project> ... <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>license-maven-plugin</artifactId> <version>2.5.0</version> <executions> <execution> <id>download-licenses</id> <goals> <goal>download-licenses</goal> </goals> </execution> </executions> </plugin> </plugins> ... </build> ... </project>
Next run your build:
mvn package
For the download-licenses
goal, licenses will by default be downloaded into the directory target/licenses
. This can be configured using the licensesOutputDirectory
parameter.
aggregate-download-licenses goal
The aggregate version of the download-licenses goal.
By default the plugin attaches to the generate-resources
phase of the build lifecycle and is only executed for the root module collecting dependencies of all reactor projects.
<project> ... <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>license-maven-plugin</artifactId> <version>2.5.0</version> <executions> <execution> <id>aggregate-download-licenses</id> <goals> <goal>aggregate-download-licenses</goal> </goals> </execution> </executions> </plugin> </plugins> ... </build> ... </project>
Next run your build:
mvn package
For the download-licenses
goal, licenses will by default be downloaded into the directory target/licenses
. This can be configured using the licensesOutputDirectory
parameter.