Skip to content

Instantly share code, notes, and snippets.

@kaorimatz
Created July 10, 2012 18:01
Show Gist options
  • Save kaorimatz/3085171 to your computer and use it in GitHub Desktop.
Save kaorimatz/3085171 to your computer and use it in GitHub Desktop.
Generate a cross reference for the maven project
#!/bin/sh
CSCOPE_OUT_DIR=$HOME/.cscope
CTAGS_OUT_DIR=$HOME/.tags
NAMEFILE=/tmp/java.files
if [ $# != 1 ]; then
echo "usega: $0 project_dir"
exit 1
fi;
PROJECT_DIR=`cd $1; pwd`
if [ ! -f $PROJECT_DIR/pom.xml ]; then
echo "Could not find any project file"
exit 1;
fi;
find $PROJECT_DIR -type f -name "*.java" | grep -v 'src/test' > $NAMEFILE
CSCOPE_OUT=$CSCOPE_OUT_DIR/`echo $PROJECT_DIR | sed -e 's/\//%/g'`
CTAGS_OUT=$CTAGS_OUT_DIR/`echo $PROJECT_DIR | sed -e 's/\//%/g'`
cscope -f $CSCOPE_OUT -i $NAMEFILE -b -q
ctags -f $CTAGS_OUT -L $NAMEFILE --extra=+q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment