Last active
December 11, 2015 05:48
-
-
Save kevin-lee/4554497 to your computer and use it in GitHub Desktop.
Simple script to get a maven dependency tree without using maven's options which are hard to remember.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########################################################## | |
## Simple script to get maven dependency tree ## | |
## @author Lee, SeongHyun (Kevin) ## | |
## @veraion 0.0.1 (2013-01-17) ## | |
## ## | |
## To change the option 'include' and 'output', change ## | |
## the values of INCLUDE_NAME and OUTPUT_NAME ## | |
## respectively. ## | |
## e.g.) to change 'include' to 'inc' and 'output' to ## | |
## 'out', ## | |
## INCLUDE_NAME="inc" ## | |
## OUTPUT_NAME="out" ## | |
########################################################## | |
extra_options="" | |
TMP_IFS=$IFS | |
IFS="=" | |
INCLUDE_NAME="include" | |
OUTPUT_NAME="output" | |
if [ -n "$1" ] | |
then | |
array1=( $1 ) | |
if [ "${array1[0]}" == $INCLUDE_NAME ] | |
then | |
extra_options="-Dincludes=${array1[1]}" | |
elif [ "${array1[0]}" == $OUTPUT_NAME ] | |
then | |
extra_options="-DoutputFile=${array1[1]}" | |
fi | |
fi | |
if [ -n "$2" ] | |
then | |
array2=( $2 ) | |
if [ "${array2[0]}" == $INCLUDE_NAME ] | |
then | |
extra_options="$extra_options -Dincludes=${array2[1]}" | |
elif [ "${array2[0]}" == $OUTPUT_NAME ] | |
then | |
extra_options="$extra_options -DoutputFile=${array2[1]}" | |
fi | |
fi | |
IFS=$TMP_IFS | |
echo -e "execute \"mvn dependency:tree $extra_options\"\n" | |
mvn dependency:tree $extra_options | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the following alias to your
~/.bashrc
.Then you can run it like
If you want to specify "-Dincludes" option, do this.
"-DoutputFile" can also be specified.
$ dep-tree output=~/Desktop/output.txt
Or both can be
$ dep-tree include=something output=~/Desktop/output.txt