aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/sonarsource/scanner/cli
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/sonarsource/scanner/cli')
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/Main.java21
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java6
2 files changed, 8 insertions, 19 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java
index d93116b..7144ec8 100644
--- a/src/main/java/org/sonarsource/scanner/cli/Main.java
+++ b/src/main/java/org/sonarsource/scanner/cli/Main.java
@@ -19,6 +19,7 @@
*/
package org.sonarsource.scanner.cli;
+import java.util.Map;
import java.util.Properties;
import org.sonarsource.scanner.api.EmbeddedScanner;
import org.sonarsource.scanner.api.ScanProperties;
@@ -64,32 +65,20 @@ public class Main {
Stats stats = new Stats(logger).start();
int status = Exit.ERROR;
- boolean started = false;
try {
Properties p = conf.properties();
checkSkip(p);
configureLogging(p);
init(p);
runner.start();
- started = true;
logger.info("SonarQube server " + runner.serverVersion());
- runAnalysis(stats, p);
+ execute(stats, p);
status = Exit.SUCCESS;
} catch (Throwable e) {
- status = Exit.ERROR;
displayExecutionResult(stats, "FAILURE");
showError("Error during SonarQube Scanner execution", e, cli.isDebugEnabled());
} finally {
- try {
- if (started) {
- runner.stop();
- }
- } catch (Throwable e) {
- status = Exit.ERROR;
- logger.error("Unable to properly stop the scanner", e);
- } finally {
- exit.exit(status);
- }
+ exit.exit(status);
}
}
@@ -118,8 +107,8 @@ public class Main {
}
}
- private void runAnalysis(Stats stats, Properties p) {
- runner.runAnalysis(p);
+ private void execute(Stats stats, Properties p) {
+ runner.execute((Map) p);
displayExecutionResult(stats, "SUCCESS");
}
diff --git a/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java b/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java
index 04a6684..7fe4d9f 100644
--- a/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java
+++ b/src/main/java/org/sonarsource/scanner/cli/ScannerFactory.java
@@ -19,6 +19,7 @@
*/
package org.sonarsource.scanner.cli;
+import java.util.Map;
import java.util.Properties;
import org.sonarsource.scanner.api.EmbeddedScanner;
import org.sonarsource.scanner.api.LogOutput;
@@ -32,9 +33,8 @@ class ScannerFactory {
}
EmbeddedScanner create(Properties props) {
- return EmbeddedScanner.create(new DefaultLogOutput())
- .addGlobalProperties(props)
- .setApp("ScannerCli", ScannerVersion.version());
+ return EmbeddedScanner.create("ScannerCli", ScannerVersion.version(), new DefaultLogOutput())
+ .addGlobalProperties((Map) props);
}
class DefaultLogOutput implements LogOutput {