diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-05-05 23:01:54 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-05-06 00:24:06 +0400 |
commit | 804816f9434ba22951a4965155df0837d21f5d22 (patch) | |
tree | 396d1e213dea4e8c4a3c5f4c1745baba73e27198 /sonar-batch/src/main | |
parent | be8c67c1396c03bf71cc2fb7770668c54e903e32 (diff) | |
download | sonarqube-804816f9434ba22951a4965155df0837d21f5d22.tar.gz sonarqube-804816f9434ba22951a4965155df0837d21f5d22.zip |
SONAR-2298 Fix bug, when root project not a first one in Maven reactor
This situation shouldn't lead to partial analysis.
Diffstat (limited to 'sonar-batch/src/main')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/MavenProjectConverter.java | 9 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/ProjectTree.java | 2 |
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); } /** |