mojohaus / license-maven-plugin

Maven plugin to download and collect license files from project dependencies.
https://www.mojohaus.org/license-maven-plugin/
GNU Lesser General Public License v3.0
107 stars 127 forks source link

Allow users to specify globalKnownLicenses in pom.xml #161

Open ptahchiev opened 5 years ago

ptahchiev commented 5 years ago

I know unknown licenses can be added with the missingFile configuration property, but this is very cumbersome when you have a multi-module project. In my case I have a project with 40 sub-modules and the license-plugin is declared in the top project pom.xml, however if I am asked to add missingFileto all the submodules. I would like to specify the missing licenses in the configuration of the plugin, such as:

                            <globalKnownLicenses>
                                <dom4j--dom4j--1.6.1>The Apache Software License, Version 2.0</dom4j--dom4j--1.6.1>
                                <jgridshift--jgridshift--1.0>The Apache Software License, Version 2.0</jgridshift--jgridshift--1.0>
                                <net.jcip--jcip-annotations--1.0>The Apache Software License, Version 2.0</net.jcip--jcip-annotations--1.0>
                                <org.codehaus.jettison--jettison--1.2>The Apache Software License, Version 2.0</org.codehaus.jettison--jettison--1.2>
                                <javax.el--el-api--2.2>Common Development and Distribution License (CDDL)</javax.el--el-api--2.2>
                                <javax.servlet--jstl--1.2>Common Development and Distribution License (CDDL)</javax.servlet--jstl--1.2>
                                <javax.xml.stream--stax-api--1.0-2>Common Development and Distribution License (CDDL)</javax.xml.stream--stax-api--1.0-2>
                                <javax.transaction--jta--1.1>Common Development and Distribution License (CDDL)</javax.transaction--jta--1.1>
                                <com.github--vfs-s3--2.4.2>The Apache Software License, Version 2.0</com.github--vfs-s3--2.4.2>
                                <org.springframework.social--spring-social-twitter--2.0.2.NEMESIS-RELEASE>The Apache Software License, Version 2.0</org.springframework.social--spring-social-twitter--2.0.2.NEMESIS-RELEASE>
                                <org.springframework.social--spring-social-twitter-autoconfigure--2.0.2.NEMESIS-RELEASE>The Apache Software License, Version 2.0</org.springframework.social--spring-social-twitter-autoconfigure--2.0.2.NEMESIS-RELEASE>
                                <com.nemesis.rules--nemesis-rules-targeting--2.0.0.RELEASE>Nemesis Software Commercial License</com.nemesis.rules--nemesis-rules-targeting--2.0.0.RELEASE>
                            </globalKnownLicenses>

And i see that a property has already been added but no other work has been done whatsoever: https://github.com/mojohaus/license-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/license/AbstractAddThirdPartyMojo.java#L561

nfalco79 commented 5 years ago

You obtain the same result of globalKnowLicenses if you put the missingFile in the root project (the workdir where you ran the mvn command) and execute aggregate-add-third-party. Instead if you run add-third-party goal value the missingFile property to point to the same file for all module like ${session.executionRootDirectory}/missing properties

ptahchiev commented 5 years ago

I can't put the missingFile in the root project, because maybe tomorrow I would like to build only moduleA so I will not run maven from the root project.