]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2878 Stop analysis if execution of Maven Plugin failed
authorEvgeny Mandrikov <mandrikov@gmail.com>
Fri, 7 Oct 2011 08:54:34 +0000 (12:54 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Fri, 7 Oct 2011 09:41:39 +0000 (13:41 +0400)
sonar-maven3-plugin/src/main/java/org/sonar/maven3/Maven3PluginExecutor.java

index b0db20a47c6a1aaaa49aaad17bb167c3073a8b65..873c1d7f8ffe43e2baf0e467f60dc5f3cd13eee0 100644 (file)
  */
 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);
+    }
   }
 
 }