My boss likes for the dependencies in a given Maven pom file to be sorted by scope, group, and artifact ID.
I've recently inherited a fair number of projects with a fair number of dependencies that were not sorted. So I sorted them.
Long story short, I want to make sure I did not inadvertently drop a dependency or copied in the wrong sorted dependency into the wrong pom.
So I was wondering if there was some sort of mechanism or Maven report plugin that will diff a pom with a previous version and show me what dependencies were added or modified.
Does anything like this exist?
I like to use a simple script to get a sorted list of dependencies and then compare them with a difftool like meld.
#!/bin/bash
# first grab all dependencies
mvn dependency:resolve >/dev/null
# then list them with -o to keep noise low,
# remove extra information and duplicates
mvn -o dependency:list \
| grep ":.*:.*:.*" \
| cut -d] -f2- \
| sed 's/:[a-z]*$//g' \
| sort -u
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With