Skip to content

Instantly share code, notes, and snippets.

@mslinn
Created July 12, 2012 21:13
Show Gist options
  • Save mslinn/3101038 to your computer and use it in GitHub Desktop.
Save mslinn/3101038 to your computer and use it in GitHub Desktop.
Shows all dependencies of an SBT project
#!/bin/bash
echo "Direct dependencies"
sbt 'show all-dependencies' | \
gawk 'match($0, /List\((.*)\)/, a) {print a[1]}' | \
tr -d ' ' | tr ',' '\n' | sort -t ':' | \
tr ':' '\t' | expand -t 30
echo -e "\nAll dependencies, including transitive dependencies"
sbt 'show managed-classpath' | tr -d ' ' | tr ',' '\n' | \
gawk 'match($0, /Attributed\((.*)\)/, a) {print a[1]}' | \
tr -d '()' | sed "s^$HOME/.ivy2/cache/^^g" | sed "s^/jars^^" | \
gawk -F / '{print $1, $3}' | sort | tr ' ' '\t' | expand -t 30
@mslinn
Copy link
Author

mslinn commented Aug 3, 2012

The dependencReport SBT plug-in works better, because it also displays transitive dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment