Skip to content

Order the license summary by name, GAV or license - #730

Merged
slachiewicz merged 2 commits into
masterfrom
order-license-summary
Aug 26, 2026
Merged

slachiewicz merged 2 commits into
masterfrom
order-license-summary

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Adds an orderBy parameter to download-licenses and aggregate-download-licenses, with four values: none, dependencyName, dependencyGav and licenseName. sortByGroupIdAndArtifactId is deprecated in favour of it, keeps working, and still applies when orderBy is left at none.

Reimplemented from #622 against current master, at @Master-Code-Programmer's design, with two changes. The options are flat mojo parameters rather than a nested <dataFormatting> element, so -Dlicense.orderBy=... works and no new public config class enters the plugin API. dependencyPluginId is renamed to dependencyGav, which is what it orders by; nothing depends on the old name because that PR was never released. The licenseMatch order needs the license classification lists and follows separately.

Every comparator falls back to group id, artifact id and version, so the output is stable when dependencies tie, and dependencyName falls back to the artifact id rather than failing when extendedInfo is off.

No new ITs. download-licenses-configured runs one of its six executions through orderBy and the other five through sortByGroupIdAndArtifactId, held against the same expected files, so the two paths are proven to agree. download-licenses-basic kept two expected files because its two dependencies could come out in either order; it now orders by dependencyName, which is the reverse of their resolution order, so one file is enough and the IT fails if the property is ignored.

Verified: mvn verify -Prun-its -Dinvoker.test=download-licenses-basic,download-licenses-configured passes, and both fail as expected when the ordering is taken back out. download-licenses-force fails on master already, unrelated to this change: opensource.org now serves an HTML page where the IT expects the LGPL text.

This change was created with AI assistance.

Ordering was limited to sortByGroupIdAndArtifactId, which is now
deprecated in favour of orderBy. Do not drop it: it stays the documented
spelling for anyone whose build sets it, and it still wins when orderBy
is left at none.

The download-licenses-basic IT kept two expected files because the two
dependencies could come out in either order; ordering by dependencyName
puts them in the reverse of their resolution order, so one file is
enough and the IT now fails if the property is ignored.

Co-authored-by: Jan-Hendrik Diederich <1955253+Master-Code-Programmer@users.noreply.github.com>
@slachiewicz
slachiewicz merged commit b3f73eb into master Aug 26, 2026
20 checks passed
@slachiewicz
slachiewicz deleted the order-license-summary branch August 26, 2026 22:31
@github-actions github-actions Bot added this to the 2.7.2 milestone Aug 26, 2026
slachiewicz added a commit that referenced this pull request Nov 1, 2026
The next release has new features (#717, #730, #731) and raises the Maven floor (#757), so it is a minor; the release draft takes its version from the POM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

download-licenses enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant