#!/bin/sh # # SonarQube Runner Startup Script for Unix # # Optional ENV vars: # SONAR_RUNNER_OPTS - Parameters passed to the Java VM when running Sonar # JAVA_HOME - Location of Java's installation real_path () { target=$1 ( while true; do cd "$(dirname "$target")" target=$(basename "$target") link=$(readlink "$target") test "$link" || break target=$link done echo "$(pwd -P)/$target" ) } echo WARN: 'sonar-runner' script is deprecated. Please use 'sonar-scanner' instead. script_path="$0" if [ -h "$script_path" ] ; then # resolve recursively symlinks script_path=$(real_path "$script_path") fi sonar_runner_home=$(dirname "$script_path")/.. # make it fully qualified sonar_runner_home=$(cd "$sonar_runner_home" && pwd) jar_file=$sonar_runner_home/lib/sonar-scanner-cli-${project.version}.jar # check that sonar_runner_home has been correctly set if [ ! -f "$jar_file" ] ; then echo "File does not exist: $jar_file" echo "'$sonar_runner_home' does not point to a valid installation directory: $sonar_runner_home" exit 1 fi if [ -n "$JAVA_HOME" ] then java_cmd="$JAVA_HOME/bin/java" else java_cmd="$(which java)" fi if [ -n "$SONAR_RUNNER_OPTS" ] ; then echo WARN: '$SONAR_RUNNER_OPTS' is deprecated. Please use '$SONAR_SCANNER_OPTS' instead. if [ -z "$SONAR_SCANNER_OPTS" ] ; then SONAR_SCANNER_OPTS=$SONAR_RUNNER_OPTS fi fi 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" exec "$java_cmd" \ -Djava.awt.headless=true \ $SONAR_SCANNER_OPTS \ -classpath "$jar_file" \ -Dscanner.home="$sonar_runner_home" \ -Dproject.home="$project_home" \ org.sonarsource.scanner.cli.Main "$@"