diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2019-09-03 15:36:13 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2019-09-05 10:03:19 +0200 |
commit | 3091d1bb8bfdb695942afdac41a5fa7c79a8ebc8 (patch) | |
tree | f3635ce9877ea9384b340d6f6adffee62b8d57ec /src/main/java/org/sonarsource/scanner/cli/Conf.java | |
parent | 7d253e8dc460e1858d5756211f0f16dafd724eae (diff) | |
download | sonar-scanner-cli-3091d1bb8bfdb695942afdac41a5fa7c79a8ebc8.tar.gz sonar-scanner-cli-3091d1bb8bfdb695942afdac41a5fa7c79a8ebc8.zip |
SQSCANNER-24 Always consider project.settings, if set
Diffstat (limited to 'src/main/java/org/sonarsource/scanner/cli/Conf.java')
-rw-r--r-- | src/main/java/org/sonarsource/scanner/cli/Conf.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Conf.java b/src/main/java/org/sonarsource/scanner/cli/Conf.java index fd33baf..0a3da87 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Conf.java +++ b/src/main/java/org/sonarsource/scanner/cli/Conf.java @@ -30,9 +30,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Properties; - import javax.annotation.Nullable; - import org.sonarsource.scanner.api.Utils; class Conf { @@ -63,7 +61,7 @@ class Conf { result.putAll(loadEnvironmentProperties()); result.putAll(cli.properties()); result = resolve(result); - + // root project base directory must be present and be absolute result.setProperty(PROPERTY_PROJECT_BASEDIR, getRootProjectBaseDir(result).toString()); result.remove(PROJECT_HOME); @@ -204,8 +202,7 @@ class Conf { return moduleProps; } - private static Path locatePropertiesFile(Properties props, String homeKey, String relativePathFromHome, - String settingsKey) { + private static Path locatePropertiesFile(Properties props, String homeKey, String relativePathFromHome, String settingsKey) { Path settingsFile = null; String scannerHome = props.getProperty(homeKey, ""); if (!"".equals(scannerHome)) { @@ -216,12 +213,12 @@ class Conf { } private static Path locatePropertiesFile(@Nullable Path defaultPath, Properties props, String settingsKey) { - Path settingsFile = defaultPath; - if (settingsFile == null || !Files.exists(settingsFile)) { - String settingsPath = props.getProperty(settingsKey, ""); - if (!"".equals(settingsPath)) { - settingsFile = Paths.get(settingsPath); - } + Path settingsFile; + String settingsPath = props.getProperty(settingsKey, ""); + if (!"".equals(settingsPath)) { + settingsFile = Paths.get(settingsPath); + } else { + settingsFile = defaultPath; } if (settingsFile != null) { |