local testDirectory=test-classes local testDirectoryLength=$((${#testDirectory} + 1)) local mavenRepository=$(eval echo ~$USER)/.m2/repository #Find test classes, and convert them their package location (rather than file system) local testsClasses=$(find . -path *target/*DaoTest.class | grep -v "/DaoTest") local tests="" for test in ${testsClasses}; do tests=${tests}" "$(echo ${test:$(($(echo ${test} | grep -b -o ${testDirectory} | cut -d: -f1) + ${testDirectoryLength}))} | sed -e 's/\//\./g' | sed -e 's/.class//g') done #Build the class path.... local jars=$(JARS=($(find deploy -name *.jar)); IFS=:; echo "${JARS[*]}") local clazzs=$(CLAZZ=($(find . -name ${testDirectory})); IFS=:; echo "${CLAZZ[*]}") local classpath=${mavenRepository}/junit/junit/4.12/junit-4.12.jar:${jars}:${clazzs} ${OPT_DIR}/jdk/bin/java -cp ${classpath} org.junit.runner.JUnitCore ${tests}