https://github.com/antonsjava/deps-size-plugin
maven plugin for calculating artifacts size
https://github.com/antonsjava/deps-size-plugin
Last synced: 4 months ago
JSON representation
maven plugin for calculating artifacts size
- Host: GitHub
- URL: https://github.com/antonsjava/deps-size-plugin
- Owner: antonsjava
- License: apache-2.0
- Created: 2024-02-17T17:01:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-17T17:47:50.000Z (over 1 year ago)
- Last Synced: 2025-03-27T18:19:46.358Z (7 months ago)
- Language: Java
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deps-size-plugin
Maven plugin for calculating artifacts size.
It is similar to **dependency:tree** but prints also size of artifact. Artifact is displayed
like "org.slf4j:slf4j-api:jar:1.7.36 <41.125, 41.125>" where first number is size of
artifact jar and second one is calculated sum of dependences (by default with runtime scope).
Calculated sum can be wrong as same artifact can be more time counted in dependence tree.
Also single jar packaging can duplicate size.
But it is useful to identify candidates to exclude from class path.
Example for this plugin
```
[INFO] io.github.antonsjava:deps-size-plugin:maven-plugin:1.0 <21.345, 250.907>
[INFO] +- org.apache.maven.shared:maven-dependency-tree:jar:3.2.1 <42.608, 229.562>
[INFO] +- org.eclipse.aether:aether-util:jar:1.0.0.v20140518 <145.829, 145.829>
[INFO] +- org.slf4j:slf4j-api:jar:1.7.36 <41.125, 41.125>
```
## usage
tree view (scope=runtime, order by brutto size)
```
mvn io.github.antonsjava:deps-size-plugin::tree
```
list view (scope=runtime, order by brutto size)
```
mvn io.github.antonsjava:deps-size-plugin::list
```
You can change sort by netto by **-Dnetto=true** param
You can set another scope by **-Dscope=compile**. Possible scopes are 'runtime' (default),
'compile+runtime', 'test', 'compile', 'runtime+system', 'provided', 'system', 'import'.
or you can define script like
```
#!/bin/bash
function helpinfo() {
echo "Prints of depended artifacts "
echo "Netto size is size of jar file in local repo. Brutto size "
echo "is sum of brutto size of dependaces. Real sum can be less"
echo "because same artifact can be counted more than one time."
echo ""
echo "Usage:"
echo " mvn-size.sh [-h|--help] [-list] [-netto] [-Dscope=]"
echo " -h|--help prints help"
echo " -list prints list instead of tree"
echo " -netto sort by netto size instead of cumulated"
echo " -Dscope= define scope for resolving artifacts"
echo " scope can be 'runtime' (default), 'compile+runtime'"
echo " 'test', 'compile', 'runtime+system', 'provided'"
echo " 'system', 'import'"
}
param1=$1
param2=$2
params=
name=tree
while [ "$#" -gt 0 ]; do
case "$1" in
-h) helpinfo; exit 1;;
--help) helpinfo; exit 1;;
-list) name=list; shift 1;;
-netto) params="$params -Dnetto=true"; shift 1;;
*) params="$params $1"; shift 1;;
esac
done
echo "starting"
echo "mvn io.github.antonsjava:deps-size::$name $params"
mvn io.github.antonsjava:deps-size-plugin::$name $params
```