Skip to content

Commit

Permalink
Issue skhatri#25: Adding capability to set JAVA_HOME for jvm in use
Browse files Browse the repository at this point in the history
  • Loading branch information
techieBrandon committed Sep 14, 2016
1 parent a6d1d50 commit dd97e32
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions sonar-runner-2.4/bin/sonar-runner
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,29 @@ if [ -z "$SONAR_RUNNER_HOME" ] ; then
SONAR_RUNNER_HOME=`cd "$SONAR_RUNNER_HOME" && pwd`
fi

if [ ! -z "$JAVA_HOME" ] ; then
JAVA_CMD="$JAVA_HOME/bin/java"
else
JAVA_CMD="`which java`"
fi

# check that the SONAR_RUNNER_HOME has been correctly set
if [ ! -f "$SONAR_RUNNER_HOME/lib/sonar-runner-dist-2.4.jar" ] ; then
echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME
exit 1
fi

JAVA_CMD="`which java`"
JAR_FILE="${SONAR_RUNNER_HOME}"/lib/sonar-runner-dist-2.4.jar
PROJECT_HOME=`pwd`

#echo "Info: Using sonar-runner at $SONAR_RUNNER_HOME"
#echo "Info: Using java at $JAVA_CMD"
#echo "Info: Using classpath $JAR_FILE"
#echo "Info: Using project $PROJECT_HOME"
echo "Info: Using sonar-runner at $SONAR_RUNNER_HOME"
echo "Info: Using java at $JAVA_CMD"
echo "Info: Using classpath $JAR_FILE"
echo "Info: Using project $PROJECT_HOME"

exec "$JAVA_CMD" \
$SONAR_RUNNER_OPTS \
-classpath $JAR_FILE \
"-Drunner.home=${SONAR_RUNNER_HOME}" \
"-Dproject.home=${PROJECT_HOME}" \
org.sonar.runner.Main "$@"
#exec "$JAVA_CMD" \
# $SONAR_RUNNER_OPTS \
# -classpath $JAR_FILE \
# "-Drunner.home=${SONAR_RUNNER_HOME}" \
# "-Dproject.home=${PROJECT_HOME}" \
# org.sonar.runner.Main "$@"

0 comments on commit dd97e32

Please sign in to comment.