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
106 stars 126 forks source link

Unable to create thirdparty (add-third-party) #264

Closed hohwille closed 5 years ago

hohwille commented 5 years ago

For whatever reason add-thrid-party does not work if packaging is pom. This seems to be by design: https://www.mojohaus.org/license-maven-plugin/examples/example-thirdparty.html

Note: This mojo has not effect on a pom project.

However, IMHO there is no rationale behind this decision. I am facing problems in my project as I do have dependencies in a module with packaging pom that I include in my assembly using the maven-dependency-plugin.

As a hackish workaround I tried to generate the THIRD-PARTY.txt in the module with jar packaging and configured:

          <outputDirectory>${basedir}/../scripts/target/package/scripts</outputDirectory>

This leads to:

[INFO] --- license-maven-plugin:1.17:add-third-party (add-third-party) @ devon-ide-configurator ---
[INFO] Writing third-party file to /projects/devon/workspaces/main/devon-ide/configurator/../scripts/target/package/scripts/THIRD-PARTY.txt

Even though the file is not written and there is no additional error message. Hence, I my case the license-maven-plugin seems buggy and not able to solve my problem. Any hints or other workarounds?

You can find the project here: https://github.com/devonfw/devon-ide

It is going to publish 3rd party stuff included in its own release (https://github.com/devonfw/devon-ide/pull/32). Therefore I would like to make use of license-maven-plugin to include a generated file telling which library is under what license. Ideally I would love to generate for each JAR that I put in the lib folder the license file with the same filename as the JAR but instead with a .license.txt / .license.html suffix. As this is not possible, I download and include the licenses but so one can understand which license belongs to what library, I would need to generate the THIRD-PARTY.txt file what seems not to be possible because of this bug.

Could you consider allowing to allow add-third-party also for pom packaging?

avdland commented 5 years ago

related: #211

ppalaga commented 5 years ago

Could you consider allowing to allow add-third-party also for pom packaging?

Yes, a PR with an integration test would be welcome. It is probably a good idea to have a property that activates the new behavior so that we stay backwards compatible.

hohwille commented 5 years ago

Mhm, maybe I was just too stupid to read the docs: https://www.mojohaus.org/license-maven-plugin/add-third-party-mojo.html#acceptPomPackaging

FYI: The second issue is not related to your plugin. As the jar module is build first it generates the THIRD-PARTY.txt properly but as mvn clean install does not first clean the entire project and then perform install build it will first delete the target directory in the pom module that contained the THIRD-PARTY.txt that was previously generated. So for such workaround one has to generate to the target of the actual module and instead use a relative link to other module in the resources.

So to summarize: There is nothing wrong with your plugin and this issue is more or less invalid. I will therefore close it.

The only remaining suggestion would be to update the documentation here: https://www.mojohaus.org/license-maven-plugin/examples/example-thirdparty.html

Note: This mojo has not effect on a pom project.

To also make it work for pom projects enable acceptPomPackaging