Skip to content

Match Maven licenses to SPDX listed license if the name matches the ID - #263

Merged
goneall merged 3 commits into
masterfrom
issue165
Aug 29, 2026
Merged

Match Maven licenses to SPDX listed license if the name matches the ID#263
goneall merged 3 commits into
masterfrom
issue165

Conversation

@goneall

@goneall goneall commented Jul 27, 2026

Copy link
Copy Markdown
Member

This partially addresses issue #165 by matching a Maven license reference to an SPDX license ID if the name matches the SPDX license identifier. This check is performed after the URL checking, so URLs take precedence.

This commit also updates the licenses.json resource file to version 3.28 The resource file is used if the SPDX license.json could not be fetched from the internet.

@pmonks

pmonks commented Jul 27, 2026

Copy link
Copy Markdown

One suggestion: might be worth attempting to parse a name as an SPDX expression, rather than just an identifier. SPDX expressions do appear in Maven POMs already (albeit rarely on Maven Central - they're a lot more common on Clojars though), and hopefully with the Maven team recommending their use they'll become more common. And of course this will also match all possible singleton license identifiers too.

@goneall

goneall commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

One suggestion: might be worth attempting to parse a name as an SPDX expression, rather than just an identifier. SPDX expressions do appear in Maven POMs already (albeit rarely on Maven Central - they're a lot more common on Clojars though), and hopefully with the Maven team recommending their use they'll become more common. And of course this will also match all possible singleton license identifiers too.

@pmonks - I updated the code to match license expressions and added some unit tests

goneall added 2 commits July 29, 2026 11:42
This partially addresses issue #165 by matching a Maven license
reference to an SPDX license ID if the name matches the SPDX license
identifier.  This check is performed after the URL checking, so URLs
take precedence.

This commit also updates the licenses.json resource file to version 3.28
The resource file is used if the SPDX license.json could not be fetched
from the internet.

Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
@agkini

agkini commented Aug 25, 2026

Copy link
Copy Markdown

@goneall Could we merge this PR, do you need any help validating this PR?

@goneall

goneall commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

@goneall Could we merge this PR, do you need any help validating this PR?

Help validating would be much appreciated - if you could either do a quick review or validate, I'll merge.

Change suggested by Copilot code review

Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
@goneall
goneall merged commit 00f976c into master Aug 29, 2026
1 check passed
@goneall
goneall deleted the issue165 branch August 29, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants