Friday, February 5, 2010

Maven Tricks

see all the libs that end up on the classpath of your maven project:

mvn dependency:build-classpath | sed 's/:/\n/g' > cp.txt

Jar search:
find . -name \*jar -print -exec jar -tvf {} \; | nawk '/YOURSEARCHSTRING/ || /jar/ {print} '

or use jarscan tool

bash script:
java -jar $JARSCAN_HOME/jarscan.jar $1 $2

alias added to .bashrc:
alias jarscan='~/dev/apps/jarscan/jarscan.sh'

and your good to go. Now you can run a recursive search of jars in any directory with a command like:
jarscan MBean

1 comment: