It seems that jcov has trouble with Java 9, and has been failing since I upgraded the
system default JVM to Java 9. This change consults JAVA_HOME for the JVM path, so that
Jenkins can override it and have a successful build.
CFB_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
INSTR_DIR="${CFB_ROOT}/../instr"
CFB_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
INSTR_DIR="${CFB_ROOT}/../instr"
+JAVA=${JAVA_HOME}/bin/java
+JAVAC=${JAVA_HOME}/bin/javac
. ${CFB_ROOT}/setcp.sh
#####################
echo Compiling...
. ${CFB_ROOT}/setcp.sh
#####################
echo Compiling...
-find "${CFB_ROOT}/prod" -name "*.java" | xargs javac -g -Xlint:deprecation
-find "${CFB_ROOT}/test" -name "*.java" | xargs javac -g -classpath ${CFB_ROOT}/prod:${CLASSPATH} -Xlint:deprecation
+find "${CFB_ROOT}/prod" -name "*.java" | xargs ${JAVAC} -g -Xlint:deprecation
+find "${CFB_ROOT}/test" -name "*.java" | xargs ${JAVAC} -g -classpath ${CFB_ROOT}/prod:${CLASSPATH} -Xlint:deprecation
if [ -d "${CFB_ROOT}/bin" ]; then
rm -rf "${CFB_ROOT}/bin"
if [ -d "${CFB_ROOT}/bin" ]; then
rm -rf "${CFB_ROOT}/bin"
#####################
echo Instrumenting...
#####################
echo Instrumenting...
-java -classpath "${CLASSPATH}" -jar `pwd`/jcov/jcov.jar Instr -t template.xml -o "${INSTR_DIR}" -type all "${CFB_ROOT}/prod"
+${JAVA} -classpath "${CLASSPATH}" -jar `pwd`/jcov/jcov.jar Instr -t template.xml -o "${INSTR_DIR}" -type all "${CFB_ROOT}/prod"
#####################
echo Running unit tests...
#####################
echo Running unit tests...
done
echo First run: locale es_ES, timezone Europe/Madrid
done
echo First run: locale es_ES, timezone Europe/Madrid
-java -Duser.language=es -Duser.country=ES -Duser.timezone=Europe/Madrid -Djcov.template=${CFB_ROOT}/template.xml -Djcov.file=${CFB_ROOT}/result.xml -classpath "${INSTR_DIR}:${CFB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${CFB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
+${JAVA} -Duser.language=es -Duser.country=ES -Duser.timezone=Europe/Madrid -Djcov.template=${CFB_ROOT}/template.xml -Djcov.file=${CFB_ROOT}/result.xml -classpath "${INSTR_DIR}:${CFB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${CFB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
echo Second run: server default locale and timezone
echo Second run: server default locale and timezone
-java -Djcov.template=${CFB_ROOT}/template.xml -Djcov.file=${CFB_ROOT}/result.xml -classpath "${INSTR_DIR}:${CFB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${CFB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
+${JAVA} -Djcov.template=${CFB_ROOT}/template.xml -Djcov.file=${CFB_ROOT}/result.xml -classpath "${INSTR_DIR}:${CFB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${CFB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
#####################
echo Generating HTML Report...
#####################
echo Generating HTML Report...
-java -jar "${CFB_ROOT}/jcov/jcov.jar" RepGen -sourcepath "${CFB_ROOT}/prod" -log.level FINE result.xml
+${JAVA} -jar "${CFB_ROOT}/jcov/jcov.jar" RepGen -sourcepath "${CFB_ROOT}/prod" -log.level FINE result.xml
#####################
echo Cleaning up
#####################
echo Cleaning up