Browse Source

SONARPLUGINS-2296 BAT script does not always return the exit code

tags/2.5-rc1
Julien HENRY 11 years ago
parent
commit
b3d8968c56
1 changed files with 16 additions and 4 deletions
  1. 16
    4
      src/main/assembly/bin/sonar-runner.bat

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



@echo off @echo off


set ERROR_CODE=0

@REM set local scope for the variables with windows NT shell
@setlocal


@REM ==== START VALIDATION ==== @REM ==== START VALIDATION ====
@REM *** JAVA EXEC VALIDATION *** @REM *** JAVA EXEC VALIDATION ***
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation, or add "java.exe" to the PATH echo location of your Java installation, or add "java.exe" to the PATH
echo. echo.
goto end
goto error


:foundJavaHome :foundJavaHome
if EXIST "%JAVA_HOME%\bin\java.exe" goto foundJavaExeFromJavaHome if EXIST "%JAVA_HOME%\bin\java.exe" goto foundJavaExeFromJavaHome
echo ERROR: JAVA_HOME exists but does not point to a valid Java home echo ERROR: JAVA_HOME exists but does not point to a valid Java home
echo folder. No "\bin\java.exe" file can be found there. echo folder. No "\bin\java.exe" file can be found there.
echo. echo.
goto end
goto error


:foundJavaExeFromJavaHome :foundJavaExeFromJavaHome
set JAVA_EXEC="%JAVA_HOME%\bin\java.exe" set JAVA_EXEC="%JAVA_HOME%\bin\java.exe"
echo ERROR: SONAR_RUNNER_HOME exists but does not point to a valid install echo ERROR: SONAR_RUNNER_HOME exists but does not point to a valid install
echo directory: %SONAR_RUNNER_HOME% echo directory: %SONAR_RUNNER_HOME%
echo. echo.
goto end
goto error






set PROJECT_HOME=%CD% set PROJECT_HOME=%CD%


%JAVA_EXEC% %SONAR_RUNNER_OPTS% -classpath "%SONAR_RUNNER_HOME%\lib\sonar-runner-${project.version}.jar" "-Drunner.home=%SONAR_RUNNER_HOME%" "-Dproject.home=%PROJECT_HOME%" org.sonar.runner.Main %* %JAVA_EXEC% %SONAR_RUNNER_OPTS% -classpath "%SONAR_RUNNER_HOME%\lib\sonar-runner-${project.version}.jar" "-Drunner.home=%SONAR_RUNNER_HOME%" "-Dproject.home=%PROJECT_HOME%" org.sonar.runner.Main %*
if ERRORLEVEL 1 goto error
goto end



:error
set ERROR_CODE=1


@REM ==== END EXECUTION ==== @REM ==== END EXECUTION ====

:end :end
@REM set local scope for the variables with windows NT shell
@endlocal & set ERROR_CODE=%ERROR_CODE%

cmd /C exit /B %ERROR_CODE%

Loading…
Cancel
Save