slachiewicz opened a new pull request, #1802: URL: https://github.com/apache/maven-dependency-plugin/pull/1802
Adds an opt-in `showSizes` parameter to `dependency:tree` (`-DshowSizes`) that annotates each node with the size of its file and the total size of everything it brings in. Closes #1544. A node's total is the size of the distinct artifacts (`groupId:artifactId:type[:classifier]:version`) it brings in: its own file plus its dependencies, transitively. Duplicates and conflict losers that Maven omitted elsewhere in the graph are credited to the subtree whose winner they resolve to, so a shared library counts under every dependency that needs it, not only where nearest-wins placed it. The losing version itself is not counted. The project total is the union over all branches, so it is less than the sum of the branch totals when branches overlap. Totals are computed before `includes`/`excludes` filtering: the filters change which nodes are shown, not their totals. The plugin builds the verbose graph internally to compute totals, and still prints the plain tree unless `-Dverbose` is set. System-scope dependencies use their `systemPath` file. An artifact that cannot be resolved, or a reactor module that resolves to its classes directory, shows as size unknown; one warning per run gives the count, and the coordinates are logged at debug. Only the `text` and `json` output types carry sizes; the others warn and resolve nothing. This is a flag on `tree` rather than a separate goal because the sizes are an annotation on the tree's own graph: a separate goal would duplicate the tree's collection, verbose mode, filters and output types. With the flag off, `tree` resolves and downloads nothing beyond what it does today (`tree-show-sizes-off` checks this). Verified: `mvn -B verify -Prun-its -Dinvoker.test='setup-*,tree*'` on Maven 3.10.0-rc-1 → 679 unit tests and 14 ITs pass; the `tree-show-sizes*` ITs also pass on 4.0.0-rc-7. Not covered by tests: a dependency whose POM declares its own repository (each node resolves through its own repositories, but the ITs use one mock repository), and performance on very large trees. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
