Browse Source

SONARPLUGINS-2044 Check if SONAR_RUNNER_HOME is correctly set

tags/2.5-rc1
Fabrice Bellingard 12 years ago
parent
commit
ef42b5a573
2 changed files with 19 additions and 4 deletions
  1. 6
    0
      src/main/assembly/bin/sonar-runner
  2. 13
    4
      src/main/assembly/bin/sonar-runner.bat

+ 6
- 0
src/main/assembly/bin/sonar-runner View File

@@ -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`"

+ 13
- 4
src/main/assembly/bin/sonar-runner.bat View File

@@ -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 ====

Loading…
Cancel
Save