From ca596c8ec2b88c31d954d71a8bd98a3b6e65afb9 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 3 Apr 2014 09:51:43 +0200 Subject: [PATCH] SONAR-5190 Should not fail if MavenProject not found for a module --- .../org/sonar/plugins/maven/MavenProjectBuilder.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/plugins/sonar-maven-batch-plugin/src/main/java/org/sonar/plugins/maven/MavenProjectBuilder.java b/plugins/sonar-maven-batch-plugin/src/main/java/org/sonar/plugins/maven/MavenProjectBuilder.java index efbef8f43e3..3d9ebb12c2f 100644 --- a/plugins/sonar-maven-batch-plugin/src/main/java/org/sonar/plugins/maven/MavenProjectBuilder.java +++ b/plugins/sonar-maven-batch-plugin/src/main/java/org/sonar/plugins/maven/MavenProjectBuilder.java @@ -51,20 +51,12 @@ public class MavenProjectBuilder extends ProjectBuilder { private void setMavenProjectIfApplicable(ProjectDefinition definition) { if (mavenSession != null) { String moduleKey = definition.getKey(); - MavenProject foundMavenModule = null; for (MavenProject mavenModule : (List) mavenSession.getSortedProjects()) { String mavenModuleKey = mavenModule.getGroupId() + ":" + mavenModule.getArtifactId(); - if (mavenModuleKey.equals(moduleKey)) { - foundMavenModule = mavenModule; - break; + if (mavenModuleKey.equals(moduleKey) && !definition.getContainerExtensions().contains(mavenModule)) { + definition.addContainerExtension(mavenModule); } } - if (foundMavenModule == null) { - throw new IllegalStateException("Unable to find Maven project in reactor with key " + moduleKey); - } - if (!definition.getContainerExtensions().contains(foundMavenModule)) { - definition.addContainerExtension(foundMavenModule); - } } } -- 2.39.5