aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-design-plugin/src
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 /plugins/sonar-design-plugin/src
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 'plugins/sonar-design-plugin/src')
-rw-r--r--plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/MavenDependenciesSensor.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/MavenDependenciesSensor.java b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/MavenDependenciesSensor.java
index aee592ad97f..3bb6f053dd2 100644
--- a/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/MavenDependenciesSensor.java
+++ b/plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/batch/MavenDependenciesSensor.java
@@ -34,6 +34,7 @@ import org.apache.maven.shared.dependency.tree.traversal.BuildingDependencyNodeV
import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor;
import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
import org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor;
+import org.sonar.api.batch.SupportedEnvironment;
import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.batch.SonarIndex;
@@ -43,6 +44,7 @@ import org.sonar.api.resources.Project;
import org.sonar.api.resources.Resource;
import org.sonar.api.utils.SonarException;
+@SupportedEnvironment({ "maven2", "maven3" })
public class MavenDependenciesSensor implements Sensor {
private ArtifactRepository localRepository;
@@ -100,7 +102,7 @@ public class MavenDependenciesSensor implements Sensor {
}
protected void saveDependency(DependencyNode node, SensorContext context) {
- Resource from = (node.getParent().getParent()==null) ? index.getProject() : toResource(node.getParent().getArtifact(), context);
+ Resource from = (node.getParent().getParent() == null) ? index.getProject() : toResource(node.getParent().getArtifact(), context);
Resource to = toResource(node.getArtifact(), context);
Dependency dependency = new Dependency(from, to);
dependency.setUsage(node.getArtifact().getScope());