diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/assembly/bin/sonar-runner.bat | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/main/assembly/bin/sonar-runner.bat b/src/main/assembly/bin/sonar-runner.bat index 87007c0..6f24d89 100644 --- a/src/main/assembly/bin/sonar-runner.bat +++ b/src/main/assembly/bin/sonar-runner.bat @@ -11,32 +11,53 @@ @REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJavaHome +@REM => JAVA EXEC +if not "%JAVA_HOME%" == "" goto foundJavaHome + +for %%i in (java.exe) do set JAVA_EXEC=%%~$PATH:i + +if not "%JAVA_EXEC%" == "" goto OkJava echo. -echo ERROR: JAVA_HOME not found in your environment. +echo ERROR: JAVA_HOME not found in your environment, and no Java +echo executable present in the PATH. echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation +echo location of your Java installation, or add "java.exe" to the PATH +echo. +goto end + +:foundJavaHome +if EXIST "%JAVA_HOME%\bin\java.exe" goto foundJavaExeFromJavaHome + +echo. +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. goto end -:OkJavaHome +:foundJavaExeFromJavaHome +set JAVA_EXEC="%JAVA_HOME%\bin\java.exe" + +: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 ==== START RUN ==== :run echo %SONAR_RUNNER_HOME% set PROJECT_HOME=%CD% -"%JAVA_HOME%\bin\java.exe" %SONAR_RUNNER_OPTS% -classpath "%SONAR_RUNNER_HOME%\lib\sonar-runner.jar";"%SONAR_RUNNER_HOME%\lib\sonar-batch-bootstrapper.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.jar";"%SONAR_RUNNER_HOME%\lib\sonar-batch-bootstrapper.jar" "-Drunner.home=%SONAR_RUNNER_HOME%" "-Dproject.home=%PROJECT_HOME%" org.sonar.runner.Main %* + @REM ==== END EXECUTION ==== |