license-maven-plugin
license-maven-plugin copied to clipboard
Override the identified during license-check
As discussed in #59 it is sometimes necessary to override the license for a certain dependency. The fix created for #59 however does this only for the license-report. This overwrite should also be applied during license checks.
Example:
I get the following error (with <failIfWarning>
is true
):
[WARNING] There are 1 forbidden licenses used:
[WARNING] License CDDL + GPLv2 with classpath exception used by 1 dependencies:
-javax.transaction API (javax.transaction:javax.transaction-api:1.2 - http://jta-spec.java.net)
Now I have created the file my-proj/src/license/override-THIRD-PARTY.properties
with the following content:
# original: CDDL + GPLv2 with classpath exception
javax.transaction--javax.transaction-api--1.2=BSD-3-Clause
... with my project pom has an whitelist entry for BSD-3-Clause
:
<configuration>
<includedLicenses>
<includedLicense>BSD-3-Clause</includedLicense>
However, the build still fails with the same error as shown above. I'd expect it not to fail.
aggregate-add-third-party
goal also would benefit from ability to override wrong/incomplete licenses
As said by @solomax , add-third-party and aggregate-add-third-party mojo use this mecanism, could you give us a little project that prove the defect @danielwegener , thanks.
Mini project attached.
Run mvn install
on it.
- It has a single dependency with license "Apache License, Version 2.0" (merged as AL v2 just to have small strings but it's the same without merges).
- It define a license override for its only dependency to dual "OVERRIDDEN" and "UNKNOWN"
- It accept only "OVERRIDDEN" licenses
Expected path should be:
"Apache License, Version 2.0" -> (merge) "AL v2" -> (override) OVERRIDDEN -> (check included) ok in whitelist.
But real path is: "Apache License, Version 2.0" -> (merge) "AL v2" -> (check included) not in whitelist!!!
If failIfWarning is false the process continue and you'll find (OVERRIDDEN) (UNKNOWN) in the third party file as expected
@danielwegener which mojos is this targeting?
It would be welcome to transform the attached project into an integration test under https://github.com/mojohaus/license-maven-plugin/tree/master/src/it