From 231a993de184196c75be888dab2da539a600fac0 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Tue, 11 Jan 2011 19:59:09 +0300 Subject: 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. --- .../src/main/java/org/sonar/maven/SonarMojo.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sonar-maven-plugin/src') diff --git a/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java b/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java index 516b2500c3b..51dd2a82d0e 100644 --- a/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java +++ b/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java @@ -40,6 +40,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; @@ -78,7 +79,7 @@ public final class SonarMojo extends AbstractMojo { /** * The artifact factory to use. - * + * * @component * @required * @readonly @@ -87,7 +88,7 @@ public final class SonarMojo extends AbstractMojo { /** * The artifact repository to use. - * + * * @parameter expression="${localRepository}" * @required * @readonly @@ -96,7 +97,7 @@ public final class SonarMojo extends AbstractMojo { /** * The artifact metadata source to use. - * + * * @component * @required * @readonly @@ -105,7 +106,7 @@ public final class SonarMojo extends AbstractMojo { /** * The artifact collector to use. - * + * * @component * @required * @readonly @@ -114,7 +115,7 @@ public final class SonarMojo extends AbstractMojo { /** * The dependency tree builder to use. - * + * * @component * @required * @readonly @@ -133,16 +134,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, pluginManager, artifactFactory, + reactor, session, project, getLog(), lifecycleExecutor, pluginManager, artifactFactory, localRepository, artifactMetadataSource, artifactCollector, dependencyTreeBuilder, projectBuilder, Environment.MAVEN2, Maven2PluginExecutor.class); batch.execute(); } - private void initLogging() throws MojoExecutionException { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); JoranConfigurator jc = new JoranConfigurator(); -- cgit v1.2.3