From 9aa05453364c7d7c6946f6e6efbef5d1de01c9e7 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 27 Jun 2011 09:02:41 +0000 Subject: SONARPLUGINS-1220 Runner home must be optional --- src/main/assembly/bin/sonar-runner | 3 +++ src/main/assembly/bin/sonar-runner.bat | 5 ++++- src/main/java/org/sonar/runner/Main.java | 9 ++++----- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main/assembly/bin/sonar-runner b/src/main/assembly/bin/sonar-runner index 9193323..16c7eb0 100755 --- a/src/main/assembly/bin/sonar-runner +++ b/src/main/assembly/bin/sonar-runner @@ -17,13 +17,16 @@ fi JAVA_CMD="`which java`" JAVA_CLASSPATH="${SONAR_RUNNER_HOME}"/lib/sonar-runner.jar:"${SONAR_RUNNER_HOME}"/lib/sonar-batch-bootstrapper.jar +PROJECT_HOME=`pwd` #echo "Info: Using sonar-runner at $SONAR_RUNNER_HOME" #echo "Info: Using java at $JAVACMD" #echo "Info: Using classpath $JAVACLASSPATH" +#echo "Info: Using project $PROJECT_HOME" exec "$JAVA_CMD" \ $SONAR_RUNNER_OPTS \ -classpath $JAVA_CLASSPATH \ "-Drunner.home=${SONAR_RUNNER_HOME}" \ + "-Dproject.home=${PROJECT_HOME}" \ org.sonar.runner.Main "$@" diff --git a/src/main/assembly/bin/sonar-runner.bat b/src/main/assembly/bin/sonar-runner.bat index 4635e80..8be6542 100644 --- a/src/main/assembly/bin/sonar-runner.bat +++ b/src/main/assembly/bin/sonar-runner.bat @@ -14,4 +14,7 @@ set SONAR_RUNNER_HOME=%~dp0.. :run echo %SONAR_RUNNER_HOME% -"%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%" org.sonar.runner.Main %* + +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 %* diff --git a/src/main/java/org/sonar/runner/Main.java b/src/main/java/org/sonar/runner/Main.java index f935d5f..1eb8b77 100644 --- a/src/main/java/org/sonar/runner/Main.java +++ b/src/main/java/org/sonar/runner/Main.java @@ -51,11 +51,10 @@ public final class Main { } static Properties loadProperties(String[] args) { - Properties props = new Properties(); - Properties commandLineProps = parseArguments(args); - props.putAll(loadRunnerProperties(commandLineProps)); - props.putAll(loadProjectProperties(commandLineProps)); - props.putAll(commandLineProps); + Properties props = parseArguments(args); + props.putAll(System.getProperties()); + props.putAll(loadRunnerProperties(props)); + props.putAll(loadProjectProperties(props)); return props; } -- cgit v1.2.3