diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-06-27 14:05:30 +0000 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-06-27 14:05:30 +0000 |
commit | 45e872297de7537dd43fc8f8f8861ef17b2763be (patch) | |
tree | d490885ff68ab6676c60e0d6a8a5e09c72853e1b /src | |
parent | 833531ea40bad147190298e84a6720591f9352f5 (diff) | |
download | sonar-scanner-cli-45e872297de7537dd43fc8f8f8861ef17b2763be.tar.gz sonar-scanner-cli-45e872297de7537dd43fc8f8f8861ef17b2763be.zip |
Sonar runner: improve log of working dir
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/sonar/runner/Main.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/main/java/org/sonar/runner/Main.java b/src/main/java/org/sonar/runner/Main.java index 8320090..e27e047 100644 --- a/src/main/java/org/sonar/runner/Main.java +++ b/src/main/java/org/sonar/runner/Main.java @@ -25,16 +25,17 @@ import org.sonar.batch.bootstrapper.BootstrapperIOUtils; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStream; import java.util.Properties; /** * Arguments : * <ul> - * <li>runner.home: optional path to runner home (root directory with sub-directories bin, lib and conf)</li> - * <li>runner.settings: optional path to runner global settings, usually ${runner.home}/conf/sonar-runner.properties. This property is used only if ${runner.home} is not defined</li> - * <li>project.home: path to project root directory. If not set, then it's supposed to be the directory where the runner is executed</li> - * <li>project.settings: optional path to project settings. Default value is ${project.home}/sonar-project.properties.</li> + * <li>runner.home: optional path to runner home (root directory with sub-directories bin, lib and conf)</li> + * <li>runner.settings: optional path to runner global settings, usually ${runner.home}/conf/sonar-runner.properties. This property is used only if ${runner.home} is not defined</li> + * <li>project.home: path to project root directory. If not set, then it's supposed to be the directory where the runner is executed</li> + * <li>project.settings: optional path to project settings. Default value is ${project.home}/sonar-project.properties.</li> * </ul> * * @since 1.0 @@ -42,12 +43,16 @@ import java.util.Properties; public final class Main { public static void main(String[] args) { - Properties props = loadProperties(args); - Runner runner = Runner.create(props); - log("Runner version: " + runner.getRunnerVersion()); - log("Server: " + runner.getServerURl()); - log("Work directory: " + runner.getWorkDir().getAbsolutePath()); - runner.execute(); + try { + Properties props = loadProperties(args); + Runner runner = Runner.create(props); + log("Runner version: " + runner.getRunnerVersion()); + log("Server: " + runner.getServerURl()); + log("Work directory: " + runner.getWorkDir().getCanonicalPath()); + runner.execute(); + } catch (IOException e) { + throw new RuntimeException(e); + } } static Properties loadProperties(String[] args) { @@ -73,7 +78,7 @@ public final class Main { static Properties loadProjectProperties(Properties props) { File settingsFile = locatePropertiesFile(props, "project.home", "sonar-project.properties", "project.settings"); - if (settingsFile!=null && settingsFile.isFile() && settingsFile.exists()) { + if (settingsFile != null && settingsFile.isFile() && settingsFile.exists()) { log("Project settings: " + settingsFile.getAbsolutePath()); return toProperties(settingsFile); } @@ -96,7 +101,6 @@ public final class Main { return settingsFile; } - private static Properties toProperties(File file) { InputStream in = null; Properties properties = new Properties(); |