aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-batch/src/main')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/MavenProjectConverter.java9
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/ProjectTree.java2
2 files changed, 7 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/MavenProjectConverter.java b/sonar-batch/src/main/java/org/sonar/batch/MavenProjectConverter.java
index 0018b1c35f4..b50f882ba58 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/MavenProjectConverter.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/MavenProjectConverter.java
@@ -36,7 +36,7 @@ public final class MavenProjectConverter {
private MavenProjectConverter() {
}
- public static ProjectDefinition convert(List<MavenProject> poms) {
+ public static ProjectDefinition convert(List<MavenProject> poms, MavenProject root) {
Map<String, MavenProject> paths = Maps.newHashMap(); // projects by canonical path
Map<MavenProject, ProjectDefinition> defs = Maps.newHashMap();
@@ -59,10 +59,13 @@ public final class MavenProjectConverter {
throw new SonarException(e);
}
- return defs.get(poms.get(0));
+ return defs.get(root);
}
- public static ProjectDefinition convert(MavenProject pom) {
+ /**
+ * Visibility has been relaxed for tests.
+ */
+ static ProjectDefinition convert(MavenProject pom) {
Properties properties = new Properties();
String key = new StringBuilder().append(pom.getGroupId()).append(":").append(pom.getArtifactId()).toString();
diff --git a/sonar-batch/src/main/java/org/sonar/batch/ProjectTree.java b/sonar-batch/src/main/java/org/sonar/batch/ProjectTree.java
index 72a599821e6..54b97fb2b6f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/ProjectTree.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/ProjectTree.java
@@ -53,7 +53,7 @@ public class ProjectTree {
protected ProjectTree(ProjectBuilder projectBuilder, List<MavenProject> poms) {
this.projectBuilder = projectBuilder;
definitions = Lists.newArrayList();
- collectProjects(MavenProjectConverter.convert(poms), definitions);
+ collectProjects(MavenProjectConverter.convert(poms, poms.get(0)), definitions);
}
/**