aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-07-20 14:00:49 +0000
committerFabrice Bellingard <bellingard@gmail.com>2012-07-20 14:00:49 +0000
commitef42b5a573cdef531e6da051fba25e7c144d1440 (patch)
treef995a42b046cc7940237153d312f739bc507746b /src
parent7ff1124e09a6acbb6eb9ea989cb246266c6ecdea (diff)
downloadsonar-scanner-cli-ef42b5a573cdef531e6da051fba25e7c144d1440.tar.gz
sonar-scanner-cli-ef42b5a573cdef531e6da051fba25e7c144d1440.zip
SONARPLUGINS-2044 Check if SONAR_RUNNER_HOME is correctly set
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main/assembly/bin/sonar-runner6
-rw-r--r--src/main/assembly/bin/sonar-runner.bat17
2 files changed, 19 insertions, 4 deletions
diff --git a/src/main/assembly/bin/sonar-runner b/src/main/assembly/bin/sonar-runner
index 42e7cc5..a9c4a75 100755
--- a/src/main/assembly/bin/sonar-runner
+++ b/src/main/assembly/bin/sonar-runner
@@ -13,6 +13,12 @@ if [ -z "$SONAR_RUNNER_HOME" ] ; then
# make it fully qualified
SONAR_RUNNER_HOME=`cd "$SONAR_RUNNER_HOME" && pwd`
+else
+ # check that the SONAR_RUNNER_HOME has been correctly set
+ if [ ! -e "$SONAR_RUNNER_HOME/lib/sonar-runner.jar" ] ; then
+ echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME
+ exit 0
+ fi
fi
JAVA_CMD="`which java`"
diff --git a/src/main/assembly/bin/sonar-runner.bat b/src/main/assembly/bin/sonar-runner.bat
index e75cf91..4896fdd 100644
--- a/src/main/assembly/bin/sonar-runner.bat
+++ b/src/main/assembly/bin/sonar-runner.bat
@@ -11,15 +11,15 @@
@REM ==== START VALIDATION ====
-@REM => JAVA EXEC
+@REM *** JAVA EXEC VALIDATION ***
if not "%JAVA_HOME%" == "" goto foundJavaHome
for %%i in (java.exe) do set JAVA_EXEC=%%~$PATH:i
-if not "%JAVA_EXEC%" == "" {
+if not "%JAVA_EXEC%" == "" (
set JAVA_EXEC="%JAVA_EXEC%"
goto OkJava
-}
+)
if not "%JAVA_EXEC%" == "" goto OkJava
@@ -43,16 +43,25 @@ goto end
:foundJavaExeFromJavaHome
set JAVA_EXEC="%JAVA_HOME%\bin\java.exe"
+@REM *** SONAR RUNNER HOME VALIDATION ***
:OkJava
if NOT "%SONAR_RUNNER_HOME%"=="" goto cleanSonarRunnerHome
set SONAR_RUNNER_HOME=%~dp0..
goto run
-@REM => SONAR_RUNNER_HOME
:cleanSonarRunnerHome
@REM If the property has a trailing backslash, remove it
if %SONAR_RUNNER_HOME:~-1%==\ set SONAR_RUNNER_HOME=%SONAR_RUNNER_HOME:~0,-1%
+@REM Check if the provided SONAR_RUNNER_HOME is a valid install dir
+IF EXIST "%SONAR_RUNNER_HOME%\lib\sonar-runner.jar" goto run
+
+echo.
+echo ERROR: SONAR_RUNNER_HOME exists but does not point to a valid install
+echo directory: %SONAR_RUNNER_HOME%
+echo.
+goto end
+
@REM ==== START RUN ====