Skip to content

feat(build): generate THIRD-PARTY inventory via license-maven-plugin - #1739

Merged
natechadwick merged 6 commits into
developmentfrom
feat/1689-license-maven-plugin
Aug 2, 2026
Merged

feat(build): generate THIRD-PARTY inventory via license-maven-plugin#1739
natechadwick merged 6 commits into
developmentfrom
feat/1689-license-maven-plugin

Conversation

@natechadwick-intsof

Copy link
Copy Markdown
Collaborator

Summary

Resolves #1689.

Stop hand-curating third-party component catalogs and version pins in NOTICE.txt and the thirdPartyCopyright resource-bundle key. The versioned inventory is generated at build time by org.codehaus.mojo:license-maven-plugin (aggregate-add-third-party) and shipped as THIRD-PARTY.txt in the installer assembly. Hand-maintained prose is a stable pointer only.

Design (no dual-maintenance)

Artifact Owner
Versioned dep/license inventory license-maven-plugintarget/generated-sources/license/THIRD-PARTY.txt
Startup / About blurb Thin pointer: Apache 2.0 + Intersoft + see THIRD-PARTY.txt
Root NOTICE.txt Same stable product notice + pointer
src/license/THIRD-PARTY.properties Missing-license overrides only (9 deps whose POMs lack license metadata)

Changes

  • Root pom.xml: pin license-maven-plugin 2.7.1, inherited=false, aggregate goal on root generate-resources
  • Slim NOTICE.txt + PSStringResources.properties (copyright year 2026, Intersoft attribution)
  • perc-distribution-tree: copy LICENSE.txt, NOTICE.txt, THIRD-PARTY.txt into assembly root (generate-resources, before antrun)
  • Tests: PSThirdPartyCopyrightTest (no version pins / no hand-curated catalogs), ThirdPartyInventoryPackagingTest
  • Docs: src/license/README.md, Erlang review under docs/ai-generated/code-reviews/

Intentionally not in this PR

Pre-PR gates

Spotless: mvnw.cmd spotless:apply then mvnw.cmd spotless:check (apply first) — BUILD SUCCESS. Feature PR contains only in-scope files (unrelated i18n cache drift discarded).

Erlang: approve — docs/ai-generated/code-reviews/1689-license-maven-plugin-erlang.md

Maven:

cd system
..\mvnw.cmd clean install
  • BUILD SUCCESS
  • Tests run: 979, Failures: 0, Errors: 0, Skipped: 244 (pre-existing skips)
  • Pre-existing javadoc entity warning on PSTransitionUtils / PSTransformT* (untouched)
mvnw.cmd license:aggregate-add-third-party
  • BUILD SUCCESS — 641 third-party dependencies, ~98 KB THIRD-PARTY.txt (do not use -N)
cd modules\perc-distribution-tree
..\..\mvnw.cmd generate-resources
  • Copies LICENSE + NOTICE + THIRD-PARTY into assembly root
..\..\mvnw.cmd generate-resources compiler:compile compiler:testCompile surefire:test -Dtest=ThirdPartyInventoryPackagingTest -Dmaven.antrun.skip=true -Dexec.skip=true
  • Tests run: 2, Failures: 0

Note: full standalone perc-distribution-tree clean install still requires prior WebUI/jetty reactor artifacts (WebUI/target missing) — pre-existing installer assembly dependency, not introduced by this change.

Test plan

  • Full reactor (or mvnw license:aggregate-add-third-party) produces non-empty target/generated-sources/license/THIRD-PARTY.txt
  • Distribution assembly root contains LICENSE.txt, NOTICE.txt, THIRD-PARTY.txt
  • Server startup thirdPartyCopyright has no dependency version pins and points at THIRD-PARTY.txt
  • No reintroduction of Lato / jTDS-version / hand-curated “Bundled Apache…” catalogs

Replace hand-curated third-party component lists and version pins in
NOTICE.txt and thirdPartyCopyright with a stable product pointer. The
versioned dependency/license inventory is now produced at build time by
org.codehaus.mojo:license-maven-plugin (aggregate-add-third-party) and
copied into the perc-distribution-tree assembly as THIRD-PARTY.txt.

Resolves #1689.

> Co-Authored by Grok Build using grok-4.5 with agent main.
Extend the #1689 inventory so the shipped file covers both Maven and npm.

- license-maven-plugin writes THIRD-PARTY-MAVEN.txt
- scripts/generate-third-party-inventory.py reads product package-lock.json
  production packages (WebUI SPA lockfile) and merges both halves into a
  single THIRD-PARTY.txt for the installer
- Unit tests for the merge script; packaging test asserts npm section

> Co-Authored by Grok Build using grok-4.5 with agent main.
Pre-push spotless:check requires property alphabetical order and execution
element order for the merge-third-party-inventory plugin.

> Co-Authored by Grok Build using grok-4.5 with agent main.
Move the #1689 inventory merge into com.intsof.common:utilities as a
product-agnostic Java API with full Javadoc and JUnit coverage (no Python
on the build classpath).

- ThirdPartyLicenseInventory: read package-lock production packages,
  merge with Maven inventory text, CLI main for exec-maven-plugin:java
- Dependency-free minimal JSON parser for lockfile packages maps
- Wire merge on perc-distribution-tree generate-resources (after utilities)
- Root keeps license-maven-plugin → THIRD-PARTY-MAVEN.txt only
- Remove scripts/generate-third-party-inventory.py path from the build

> Co-Authored by Grok Build using grok-4.5 with agent main.
@kilo-code-bot

kilo-code-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No New Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0

This is an incremental review of the new commit on top of 3cd57f275:
0b81eaa05 fix(utilities): fail loud on missing npm lock sources for license inventory. Previously flagged issues are re-verified below.

Resolved since previous review

Previous issue Status
ThirdPartyLicenseInventory.java:220 silent skip of missing listed locks RESOLVEDcollectProductionPackagesFromLockList now records missing locks in NpmCollectionResult.missingLockFiles; readProductionPackagesFromLockList (wrapper) and generateMergedInventory(..., requireCompleteSources=true) both fail via requireCompleteNpmSources.
ThirdPartyLicenseInventory.java:244 silent empty list when npm-package-locks.txt absent RESOLVEDcollectProductionPackagesFromLockList returns lockListFileMissing=true; strict mode throws IllegalStateException with the list path; covered by runMainStrictFailsOnMissingLockList test.
ThirdPartyLicenseInventory.java:477 wasteful re-read + dead Files.isRegularFile check in runMain RESOLVEDgenerateMergedInventory now returns GenerateResult carrying npmPackageCount, mavenPresent, and missingLockFiles in a single pass; the post-write re-read is gone.
ThirdPartyLicenseInventory.java:159 inconsistent error handling (SUGGESTION) RESOLVED — API split into non-throwing collectProductionPackagesFromLockList and throwing readProductionPackagesFromLockList; lockfile-vs-list difference is documented and tested.
ThirdPartyLicenseInventoryTest.java coverage gaps (silent-skip paths, NpmPackage blank-license normalization, licenseFromMeta map/list forms, CLI flag parsing) RESOLVED — five new tests added: readProductionPackagesFromLockFileThrowsWhenMissing, collectReportsMissingLockListAndMissingListedLocks, readLockListThrowsWhenListFileMissing, npmPackageNormalizesBlankLicense, licenseFromMetaViaLockSupportsMapAndListForms, plus CLI tests runMainStrictFailsOnMissingLockList and runMainHelpExitsZero.
ThirdPartyInventoryPackagingTest.java:71,78 tautological assertions RESOLVED — replaced with three targeted header / npm: coordinate assertions.

Verification on changed lines (3cd57f275..0b81eaa05)

All hunks in ThirdPartyLicenseInventory.java, ThirdPartyLicenseInventoryTest.java, and ThirdPartyInventoryPackagingTest.java were re-read in full against the current HEAD. The new code:

  • Fails closed in strict mode (default for product build via --require-maven): missing npm-package-locks.txt, missing listed lockfiles, and missing Maven inventory all throw IllegalStateException BEFORE any output is written.
  • Writes the npm intermediate file and merged file only after the strict-mode gate passes; no partial-output leakage.
  • Preserves the non-strict convenience path with stderr WARN + exit 0 — intentional design, documented in JavaDoc.
  • Tests cover both APIs (strict and non-strict) and both nested record types (NpmCollectionResult, GenerateResult).

No new CRITICAL / WARNING / SUGGESTION issues were identified on the changed lines.

Pre-existing notes (unchanged lines, OUT OF SCOPE)

  • ThirdPartyLicenseInventory.java:573 resolves relative --lock-list against CWD, not --root. Pre-existing behavior; flagged for future API documentation cleanup if any external caller relies on relative paths.
  • pom.xml:3081 duplicate Apache License, Version 2.0 and the pre-PR-publication cross-platform portability guidance remain unchanged.

Notes on publication

A pending review by kilo-code-bot[bot] (review id 4838658249) on this PR continues to prevent posting new inline review comments via POST /reviews (HTTP 422 — "User can only have one pending review per pull request"). Since no new findings emerged on the changed lines, no inline comments are required; this summary alone satisfies the review record.

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 3cd57f2)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 3cd57f2)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 1

This is an incremental review of the new commits on top of 9dcba97c2:
8f50ccabd feat(utilities): generic ThirdPartyLicenseInventory for Maven+npm merge and 3cd57f275 fix(build): single exec-maven-plugin for license merge in distribution-tree. Previously flagged issues are re-verified below.

Resolved since previous review

Previous issue Status
pom.xml:247 default <python.executable>python</python.executable> (cross-platform hazard) RESOLVED — property removed (the entire Python merge pipeline is replaced by Java in com.intsof.common:utilities).
pom.xml:3112 unconditional exec-maven-plugin Python exec with no skip guard RESOLVED — replaced with <goal>java</goal> against the com.intsof.common.utilities.license.ThirdPartyLicenseInventory main class, configured inside modules/perc-distribution-tree/pom.xml only (no longer inherited=false root plugin).
scripts/generate-third-party-inventory.py:117 Unknown license fallback without warning OUT OF SCOPE — Python script deleted; the new Java implementation (ThirdPartyLicenseInventory.java) also defaults license to "Unknown license" when blank in NpmPackage compact constructor (line 95-100) and licenseFromMeta (lines 570-596), but without any aggregate warning. The deletion is acceptable; the new behavior is documented in JavaDoc.
scripts/generate-third-party-inventory.py:45 silent empty npm-package-locks.txt NOT FIXED — see WARNING below; the same defect exists in readLockList (line 244) and readProductionPackagesFromLockList (line 220) of the new Java implementation.
pom.xml:3081 duplicate Apache License, Version 2.0 in licenseMerge UNCHANGED — line is not touched by the incremental diff; pre-existing.
ThirdPartyInventoryPackagingTest.java:71,78 tautological assertions UNCHANGED — test file not touched by incremental diff; pre-existing.

New / re-verified issues on changed lines

WARNING

File Line Issue
modules/intsof-common-utilities/src/main/java/com/intsof/common/utilities/license/ThirdPartyLicenseInventory.java 220 readProductionPackagesFromLockList silently skips entries in npm-package-locks.txt whose package-lock.json is not a regular file. The shipped THIRD-PARTY.txt then lists zero npm entries from that source with no warning. Same defect as the previous review's scripts/generate-third-party-inventory.py:45. Recommend warning to stderr or returning skipped paths so callers can fail the build.
modules/intsof-common-utilities/src/main/java/com/intsof/common/utilities/license/ThirdPartyLicenseInventory.java 244 readLockList returns List.of() silently when npm-package-locks.txt is absent. The merged THIRD-PARTY.txt looks complete but contains zero npm entries. Same defect as previous review. Recommend surfacing the missing list path to stderr and/or exiting non-zero.
modules/intsof-common-utilities/src/main/java/com/intsof/common/utilities/license/ThirdPartyLicenseInventory.java 477 runMain re-reads every lockfile just to compute npmCount after the merged file was already written successfully. Wasteful, and a stale/deleted lockfile at this point yields a confusing ERROR: ... message for what was actually a successful write. The Files.isRegularFile(outDir.resolve(npmName)) check is also dead — generateMergedInventory always writes that file. Recommend returning the package list from generateMergedInventory instead of re-reading.

SUGGESTION

File Line Issue
modules/intsof-common-utilities/src/main/java/com/intsof/common/utilities/license/ThirdPartyLicenseInventory.java 159 Inconsistent error handling for the same condition: readProductionPackagesFromLockFile throws IllegalArgumentException when the lockfile is missing, but the list-driven path (readProductionPackagesFromLockList line 220) silently skips. Pick one behavior (silent-skip + warning is more useful for build pipelines) and apply in both places.

Additional observation (not inline-anchorable, change-class completeness)

ThirdPartyLicenseInventoryTest.java does not cover the silent-skip paths above, the NpmPackage compact constructor's blank-license normalization (line 95-100), the licenseFromMeta map/list forms (lines 570-596), the runMain CLI flag parsing, or BOM handling in lockfiles. Per root AGENTS.md ("you must ALWAYS update or create unit tests for any code change... tests must pass") and REVIEW.md ("Behavioral tests required for new non-trivial logic"), the new library API has uncovered paths — particularly the silent-skip behavior, which is the same defect pattern this PR inherits from the deleted Python implementation.

Notes on publication

A pending review by kilo-code-bot[bot] (review id 4838658249) on this PR prevented posting new inline review comments via the POST /reviews endpoint (HTTP 422 — "User can only have one pending review per pull request"). The DELETE/PATCH to cancel the pending review was also rejected by the agent's permission gate. Inline findings are therefore documented in the table above; the summary itself uses the issue-comments endpoint which is unaffected. To convert these into inline comments, cancel review 4838658249 and re-run this code-review pass.

Files Reviewed (incremental — 10 files)
  • modules/intsof-common-utilities/README.md — 0 issues (docs match new Java API)
  • modules/intsof-common-utilities/src/main/java/com/intsof/common/utilities/license/ThirdPartyLicenseInventory.java — 3 issues (NEW, 798 lines)
  • modules/intsof-common-utilities/src/test/java/com/intsof/common/utilities/license/ThirdPartyLicenseInventoryTest.java — 0 inline issues; coverage gaps noted above (NEW, 164 lines)
  • modules/perc-distribution-tree/pom.xml — 0 issues (exec-maven-plugin java goal wired correctly; --require-maven guard preserves previous-review fix; runs before copy-license-inventory)
  • pom.xml — 0 issues (Python exec block removed; python.executable property removed; comment block updated to reference Java merger)
  • scripts/README.md — 0 issues (docs consistent with new Java location)
  • src/license/README.md — 0 issues (correctly points at ThirdPartyLicenseInventory in com.intsof.common:utilities)
  • scripts/generate-third-party-inventory.py — DELETED (issue Bump org.apache.poi:poi-ooxml from 5.2.2 to 5.4.0 #4 of previous review migrated into Java — see WARNING above; the migration preserves the silent-skip defect rather than fixing it)
  • scripts/generate-third-party-inventory.bat — DELETED (Windows launcher no longer needed)
  • scripts/test_generate_third_party_inventory.py — DELETED (replaced by ThirdPartyLicenseInventoryTest.java)

Fix these issues in Kilo Cloud

Previous review (commit 9dcba97)

Status: 7 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 4
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
pom.xml 247 Default <python.executable>python</python.executable> is a cross-platform hazard — python is missing on stock macOS / many Linux distros / minimal CI images. Project standard is python3 (root AGENTS.md, all sister scripts).
pom.xml 3112 The <executable>${python.executable}</executable> exec-maven-plugin goal runs unconditionally on every root generate-resources. No -Dlicense.skipMerge / <skip> guard; no idempotence on already-merged THIRD-PARTY.txt. Breaks clean installs on machines with Python but missing npm/node_modules.
scripts/generate-third-party-inventory.py 117 node_modules/<name>/package.json fallback silently emits "Unknown license" for every npm production dep on clean CI (no node_modules/ present). The shipped THIRD-PARTY.txt will then list hundreds of deps as "Unknown license" without any warning summary.
scripts/generate-third-party-inventory.py 45 When npm-package-locks.txt is missing, read_lock_list returns [] silently and the script emits an empty THIRD-PARTY-NPM.txt — the merged THIRD-PARTY.txt looks complete but contains zero npm entries.

SUGGESTION

File Line Issue
pom.xml 3081 licenseMerge for Apache 2.0 contains a duplicate entry (Apache License, Version 2.0 appears at start and end). Harmless but signals a paste typo.
modules/perc-distribution-tree/src/test/java/com/percussion/distribution/install/ThirdPartyInventoryPackagingTest.java 71 `text.contains("license")
modules/perc-distribution-tree/src/test/java/com/percussion/distribution/install/ThirdPartyInventoryPackagingTest.java 78 `text.contains("npm third-party dependencies")
Files Reviewed (14 files)
  • NOTICE.txt — 0 issues
  • pom.xml — 3 issues
  • modules/perc-distribution-tree/pom.xml — 0 issues (correct invocation, file copies in generate-resources)
  • modules/perc-distribution-tree/src/test/java/com/percussion/distribution/install/ThirdPartyInventoryPackagingTest.java — 2 issues
  • scripts/README.md — 0 issues (docs updates are consistent)
  • scripts/generate-third-party-inventory.py — 2 issues
  • scripts/generate-third-party-inventory.bat — 0 issues
  • scripts/test_generate_third_party_inventory.py — 0 issues (3 tests cover production/dev filtering, merge shape, end-to-end)
  • src/license/README.md — 0 issues (matches generator behavior)
  • src/license/THIRD-PARTY.properties — 0 issues (8 missing-license overrides, correctly named)
  • src/license/npm-package-locks.txt — 0 issues (single lockfile, with explanatory comments)
  • system/src/main/resources/com/percussion/server/PSStringResources.properties — 0 issues (slim pointer, no version pins)
  • system/src/test/java/com/percussion/server/PSThirdPartyCopyrightTest.java — 0 issues (regexes are sound; LICENSE.txt + pom.xml root detection in resolveRepoRoot is portable)
  • docs/ai-generated/code-reviews/1689-license-maven-plugin-erlang.md — 0 issues (durable review report)

Notes on publication

A pending review by kilo-code-bot[bot] (review id 4838658249) on this PR prevented posting new inline review comments via the POST /reviews endpoint (HTTP 422 — "User can only have one pending review per pull request"). Inline findings are therefore documented in the table above; the summary itself uses the issue-comments endpoint which is unaffected. To convert these into inline comments, submit/cancel the existing pending review and re-run this code-review pass.

Fix these issues in Kilo Cloud


Reviewed by minimax-m3 · Input: 61.7K · Output: 6.3K · Cached: 986.8K

Review guidance: REVIEW.md from base branch development

…n-tree

Avoid duplicate org.codehaus.mojo:exec-maven-plugin declarations (Maven warning
and unstable merge). Attach merge-third-party-inventory to the existing
exec-maven-plugin next to setup-home / verify-jdbc-drivers.

> Co-Authored by Grok Build using grok-4.5 with agent main.
…entory

Address Kilo review on PR #1739:

- collectProductionPackagesFromLockList records missing lock-list / locks
- --require-maven requires complete Maven + npm sources (no silent empty npm)
- GenerateResult carries npmPackageCount (no second lockfile pass in runMain)
- Expand ThirdPartyLicenseInventoryTest (13 cases)
- Tighten packaging test assertions (drop tautologies)

> Co-Authored by Grok Build using grok-4.5 with agent main.
@natechadwick-intsof

Copy link
Copy Markdown
Collaborator Author

Mitigation (commit 0b81eaa): Addressed the latest Kilo review on the Java inventory merger.

WARNINGs fixed

  1. Missing listed package-locks: collectProductionPackagesFromLockList returns NpmCollectionResult with missingLockFiles; --require-maven fails the build via requireCompleteNpmSources.
  2. Missing lock-list file: lockListFileMissing + strict mode IllegalStateException (no silent empty npm half).
  3. runMain double-read: GenerateResult carries npmPackageCount/mavenPresent after a single pass.

Tests

ThirdPartyLicenseInventoryTest: 13 cases. Packaging test tightened (section headers + npm: coordinate).

See commit 0b81eaa on feat/1689-license-maven-plugin.

@natechadwick
natechadwick merged commit 9f3cfba into development Aug 2, 2026
8 checks passed
@natechadwick
natechadwick deleted the feat/1689-license-maven-plugin branch August 2, 2026 16:20
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.

feat(build): adopt mojohaus license-maven-plugin to generate NOTICE / third-party inventory at build time Update server startup license disclaimer

2 participants