Skip to content

List the bundled dependencies' licenses, with their texts and notices - #57

Merged
jadamcrain merged 2 commits into
mainfrom
third-party-licenses
Oct 14, 2026
Merged

jadamcrain merged 2 commits into
mainfrom
third-party-licenses

Conversation

@jadamcrain

Copy link
Copy Markdown
Member

The runnable jar and the CLI zip bundle dnp3c's dependencies, but they didn't carry those dependencies' licenses. This PR has the build produce and check them with the license-maven-plugin (2.7.1).

What ships

  • META-INF/third-party/ in the jars, and third-party/ in the CLI zip:
    • THIRD-PARTY.txt: each bundled dependency and its licenses;
    • each license's text, and the upstream NOTICE files of jSerialComm and Scala, which aren't in their jars;
    • licenses-resolved.xml: which file goes with which dependency.
  • The runnable jar's META-INF/NOTICE merges the NOTICE files found inside the dependencies' jars; for now that's only commons-cli's. Their LICENSE files used to overwrite each other there, and are now left out.

How it's kept correct

  • License allowlist: the build fails on a dependency whose licenses aren't allowed, or that has no license. Apache-2.0 and MIT are allowed for now. A dual-licensed dependency passes if either license is allowed.
  • Committed texts: the texts and the mapping are committed under src/license. A build reads them rather than downloading them, including offline. It downloads only what it hasn't seen and never deletes anything, so any change shows in git. CI and the release workflow both fail until that change is reviewed and committed.
  • Corrections: src/license/licenses.xml fixes what the POMs say, for the versions reviewed:
    • jSerialComm and JNA are taken under Apache-2.0, out of their dual licenses;
    • the MIT texts come from the projects' tagged LICENSE files, which carry their copyright lines, instead of a generic page;
    • jSerialComm's and Scala's NOTICE files come from their tagged sources.
  • Checksums: each download gets a fixed file name and is checked against a checksum when it's downloaded.
  • Upgrades: an upgraded dependency doesn't match its pinned correction, so it gets the license its POM gives: a new file and a changed mapping in src/license. That fails the guard until the entry is reviewed and updated.

Checked locally: an offline build changes nothing, a deleted text is restored unchanged, and a version that no longer matches its correction changes src/license.

CLAUDE.md describes the process.

The license-maven-plugin, in the build:

- add-third-party writes THIRD-PARTY.txt, the dependencies the CLI jar
  bundles and their licenses, and fails the build on one under a license
  that isn't allowed (Apache-2.0 and MIT, for now) or without one.
- download-licenses keeps each license's text in src/license/texts, and
  which dependency each is for in src/license/licenses-resolved.xml, both
  committed. A build reads them rather than downloads them, offline too;
  it downloads only what it hasn't seen, and deletes nothing. Whatever
  changes shows in git, and CI and the release fail until it's reviewed
  and committed.
- src/license/licenses.xml corrects what the POMs say, for the versions
  reviewed: jSerialComm and JNA are taken under Apache-2.0, of their dual
  licenses; the MIT texts come from the projects' tagged LICENSE files,
  with their copyright lines; and jSerialComm's and Scala's NOTICE files,
  which aren't in their jars, come from their tagged sources. Each
  download is named and checked against a checksum. An upgraded
  dependency gets the license its POM gives until its entry is updated.

The list, the texts and the mapping go in META-INF/third-party in the jars
and in third-party in the CLI zip. The shade plugin merges the NOTICE
files inside the dependencies' jars into the runnable jar's, and leaves
out their LICENSE files, which overwrote each other there.
@jadamcrain
jadamcrain merged commit 5b549cc into main Oct 14, 2026
5 checks passed
@jadamcrain
jadamcrain deleted the third-party-licenses branch October 14, 2026 19:14
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.

1 participant