Skip to content

Instantly share code, notes, and snippets.

@ishchegl
Last active August 7, 2018 12:06
Show Gist options
  • Save ishchegl/318c76410ad4d8b33a935afcd57dff6e to your computer and use it in GitHub Desktop.
Save ishchegl/318c76410ad4d8b33a935afcd57dff6e to your computer and use it in GitHub Desktop.
List all the JARs in local Maven repository containing specified class.
#!/bin/bash
# List all the JARs in local Maven repository containing specified class.
#
# Usage: ./jarsearch.sh CLASSNAME
CLASSNAME="$1"
MAVEN_LOCAL_REPO="$HOME/.m2"
find "$MAVEN_LOCAL_REPO" -name "*.jar" | xargs -I{} bash -c "jar -tf {} | grep -q /${CLASSNAME}.class && echo {}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment