/license-maven-plugin

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

Primary LanguageJava

license-maven-plugin

This is the license-maven-plugin. It has been forked and extended with the option to extract more license information from the dependencies. It can also write a report to an Excel file.

Information about the source project (the license stays of course the same):

Build status Tests pass locally, currently just not on Github.

Gitter The GNU Lesser General Public License, Version 3.0

Releasing

  • Make sure gpg-agent is running.
  • Execute mvn -B release:prepare release:perform

For publishing the site do the following:

cd target/checkout
mvn verify site -DperformRelease scm-publish:publish-scm

How to configure the extended Excel report

The projects pom.xml must have the lines marked with "<!-- New -->" to use the new options (extendedInfo and writeExcelFile):

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>2.1.0-SNAPSHOT</version>
                <configuration>
                    <!-- New -->
                    <extendedInfo>true</extendedInfo>
                    <!-- New -->
                    <writeExcelFile>true</writeExcelFile>
                    ...

                    <!-- Not needed, but a suggestion -->
                    <!-- Makes it more readable, licenses are the same with different names -->
                    <licenseMerges>
                        <licenseMerge>Apache License, Version 2.0|Apache 2.0|Apache 2|Apache License 2.0|The Apache
                            Software License, Version 2.0|Apache
                            License, version 2.0|AL 2.0|ASF 2.0
                        </licenseMerge>
                        <licenseMerge>MIT License|The MIT License|The MIT License (MIT)</licenseMerge>
                        <licenseMerge>GNU Lesser General Public License|GNU Lesser General Public Licence|GNU LESSER
                            GENERAL PUBLIC LICENSE|GNU Lesser
                            Public License|Lesser General Public License (LGPL)
                        </licenseMerge>
                        <licenseMerge>GNU General Lesser Public License (LGPL) version 3.0|GNU LESSER GENERAL PUBLIC
                            LICENSE, version 3 (LGPL-3.0)
                        </licenseMerge>
                        <!-- Problematic: While the maven plugins may have a simple declaration of "BSD" for their license, they may mean "New BSD" license, at least that's what they state on their websites. -->
                        <licenseMerge>The BSD License|BSD License|BSD</licenseMerge>
                        <licenseMerge>The BSD 3-Clause License|The New BSD License|New BSD License</licenseMerge>
                    </licenseMerges>

Since this hasn't been published to the official Maven repository yet, you must compile it yourself and install it to your local repository.

If you want to include it in your project and make sure all dependencies are packed together and solved, install it by adding:

<properties>
    <third.party.dir>  <Your-Dir-Where-The-JAR-Is-Located>  </third.party.dir>
</properties>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <version>3.0.0-M1</version>
                <configuration>
                    <updateReleaseInfo>true</updateReleaseInfo>
                </configuration>
            </plugin>
            ...
    </pluginManagement>

    <plugins>
        <plugin>
            <artifactId>maven-install-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
                <execution>
                    <id>install-own-maven-license-plugin</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                    <configuration>
                        <file>${third.party.dir}/license-maven-plugin-2.1.0-SNAPSHOT.jar</file>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <version>2.1.0-SNAPSHOT</version>
                        <packaging>jar</packaging>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        ...

Then, to install the plugin a mvn validate is enough.

After that, generate the report with mvn license:aggregate-download-licenses.

Under ./target/generated-resources/licenses.xlsx is then the generated Excel-Report with the extended information.