From 3174a29201e922db758b51f4b693ca131e7037ec Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Fri, 7 Oct 2011 12:54:34 +0400 Subject: SONAR-2878 Stop analysis if execution of Maven Plugin failed --- .../src/main/java/org/sonar/maven3/Maven3PluginExecutor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sonar-maven3-plugin/src/main/java/org/sonar/maven3/Maven3PluginExecutor.java b/sonar-maven3-plugin/src/main/java/org/sonar/maven3/Maven3PluginExecutor.java index b0db20a47c6..873c1d7f8ff 100644 --- a/sonar-maven3-plugin/src/main/java/org/sonar/maven3/Maven3PluginExecutor.java +++ b/sonar-maven3-plugin/src/main/java/org/sonar/maven3/Maven3PluginExecutor.java @@ -19,13 +19,14 @@ */ package org.sonar.maven3; +import java.util.Arrays; + import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.LifecycleExecutor; import org.apache.maven.project.MavenProject; +import org.sonar.api.utils.SonarException; import org.sonar.batch.AbstractMavenPluginExecutor; -import java.util.Arrays; - public class Maven3PluginExecutor extends AbstractMavenPluginExecutor { private LifecycleExecutor lifecycleExecutor; @@ -46,6 +47,9 @@ public class Maven3PluginExecutor extends AbstractMavenPluginExecutor { projectSession.getRequest().setGoals(Arrays.asList(goal)); projectSession.getRequest().setInteractiveMode(false); lifecycleExecutor.execute(projectSession); + if (projectSession.getResult().hasExceptions()) { + throw new SonarException("Exception during execution of " + goal); + } } } -- cgit v1.2.3