diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-06-27 10:36:46 +0000 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-06-27 10:36:46 +0000 |
commit | 833531ea40bad147190298e84a6720591f9352f5 (patch) | |
tree | d3dccb76d87e7460c7487643b1aa3133eba67d30 /src | |
parent | 9aa05453364c7d7c6946f6e6efbef5d1de01c9e7 (diff) | |
download | sonar-scanner-cli-833531ea40bad147190298e84a6720591f9352f5.tar.gz sonar-scanner-cli-833531ea40bad147190298e84a6720591f9352f5.zip |
SONARPLUGINS-1220 command-line properties must override global and project settings
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/sonar/runner/Main.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/org/sonar/runner/Main.java b/src/main/java/org/sonar/runner/Main.java index 1eb8b77..8320090 100644 --- a/src/main/java/org/sonar/runner/Main.java +++ b/src/main/java/org/sonar/runner/Main.java @@ -51,11 +51,15 @@ public final class Main { } static Properties loadProperties(String[] args) { - Properties props = parseArguments(args); - props.putAll(System.getProperties()); - props.putAll(loadRunnerProperties(props)); - props.putAll(loadProjectProperties(props)); - return props; + Properties commandLineProps = new Properties(); + commandLineProps.putAll(System.getProperties()); + commandLineProps.putAll(parseArguments(args)); + + Properties result = new Properties(); + result.putAll(loadRunnerProperties(commandLineProps)); + result.putAll(loadProjectProperties(commandLineProps)); + result.putAll(commandLineProps); + return result; } static Properties loadRunnerProperties(Properties props) { @@ -69,7 +73,7 @@ public final class Main { static Properties loadProjectProperties(Properties props) { File settingsFile = locatePropertiesFile(props, "project.home", "sonar-project.properties", "project.settings"); - if (settingsFile.isFile() && settingsFile.exists()) { + if (settingsFile!=null && settingsFile.isFile() && settingsFile.exists()) { log("Project settings: " + settingsFile.getAbsolutePath()); return toProperties(settingsFile); } |