From: Julien HENRY Date: Thu, 3 Apr 2014 07:51:43 +0000 (+0200) Subject: SONAR-5190 Should not fail if MavenProject not found for a module X-Git-Tag: 4.3~177 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ca596c8ec2b88c31d954d71a8bd98a3b6e65afb9;p=sonarqube.git SONAR-5190 Should not fail if MavenProject not found for a module --- 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); - } } }