summaryrefslogtreecommitdiffstats
path: root/sonar-maven3-plugin
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-01-11 19:59:09 +0300
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-01-18 15:11:11 +0300
commit231a993de184196c75be888dab2da539a600fac0 (patch)
tree22b7054e9317b8bd8077500e8613554ee3a337b4 /sonar-maven3-plugin
parenta88512126dc63e77c19c62a495b984379a01f020 (diff)
downloadsonarqube-231a993de184196c75be888dab2da539a600fac0.tar.gz
sonarqube-231a993de184196c75be888dab2da539a600fac0.zip
SONAR-1514: Add support for a new Ant task to analyze projects
* Add new environment - Ant. * Introduce new component (Reactor) in order to break dependency on MavenSession. * Add annotation SupportedEnvironment and corresponding check to BatchPluginRepository. To allow specify in which environments BatchExtension should be active. * Use this new annotation to disable MavenDependenciesSensor in Ant environment.
Diffstat (limited to 'sonar-maven3-plugin')
-rw-r--r--sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java b/sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java
index c8e65ab678e..8c9b821722a 100644
--- a/sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java
+++ b/sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java
@@ -39,6 +39,7 @@ import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
import org.slf4j.LoggerFactory;
import org.sonar.api.platform.Environment;
import org.sonar.batch.Batch;
+import org.sonar.batch.MavenReactor;
import java.io.InputStream;
@@ -69,10 +70,9 @@ public final class SonarMojo extends AbstractMojo {
*/
private LifecycleExecutor lifecycleExecutor;
-
/**
* The artifact factory to use.
- *
+ *
* @component
* @required
* @readonly
@@ -81,7 +81,7 @@ public final class SonarMojo extends AbstractMojo {
/**
* The artifact repository to use.
- *
+ *
* @parameter expression="${localRepository}"
* @required
* @readonly
@@ -90,7 +90,7 @@ public final class SonarMojo extends AbstractMojo {
/**
* The artifact metadata source to use.
- *
+ *
* @component
* @required
* @readonly
@@ -99,7 +99,7 @@ public final class SonarMojo extends AbstractMojo {
/**
* The artifact collector to use.
- *
+ *
* @component
* @required
* @readonly
@@ -108,7 +108,7 @@ public final class SonarMojo extends AbstractMojo {
/**
* The dependency tree builder to use.
- *
+ *
* @component
* @required
* @readonly
@@ -127,16 +127,15 @@ public final class SonarMojo extends AbstractMojo {
executeBatch();
}
-
private void executeBatch() throws MojoExecutionException {
+ MavenReactor reactor = new MavenReactor(session);
Batch batch = new Batch(getInitialConfiguration(),
- session, project, getLog(), lifecycleExecutor, artifactFactory,
+ reactor, session, project, getLog(), lifecycleExecutor, artifactFactory,
localRepository, artifactMetadataSource, artifactCollector, dependencyTreeBuilder,
projectBuilder, Environment.MAVEN3, Maven3PluginExecutor.class);
batch.execute();
}
-
private void initLogging() throws MojoExecutionException {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator jc = new JoranConfigurator();