Wednesday, September 26, 2012

Find a jar

Find what jar a class belongs to in your local maven repo

Have you ever had to figure out what jar a class file belongs to? Here is a quick way to search in your local maven repo to find out what jar it is in:
Maven 1
find ~/.maven/ -name '*.jar' | xargs grep classname

Maven 2
find ~/.m2/ -name '*.jar' | xargs grep classname
If you are on windows and can not use find, your best bet is to install cygwin. It is a great free utility for windows that lets you use linux commands in windows. With a little work it will even let you run X-windows stuff. 

No comments:

Post a Comment