From: Julien HENRY Date: Wed, 3 Dec 2014 23:12:45 +0000 (+0100) Subject: SONARUNNER-125 Fix duplicate properties when parsing complexe sonar-project.properties X-Git-Tag: 2.5-rc1~97 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8632a8cd838273b3946a7b4e79a86e2927b70d8d;p=sonar-scanner-cli.git SONARUNNER-125 Fix duplicate properties when parsing complexe sonar-project.properties --- diff --git a/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java b/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java index 6ba9d72..4066f83 100644 --- a/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java +++ b/sonar-runner-dist/src/main/java/org/sonar/runner/Conf.java @@ -101,7 +101,7 @@ class Conf { moduleProps = loadChildConfigFile(parentBaseDir, moduleProps, module); // the child project may have children as well - loadModulesProperties(moduleProps, projectProps, module + "."); + loadModulesProperties(moduleProps, projectProps, prefix + module + "."); // and finally add this child properties to global props merge(projectProps, prefix, module, moduleProps); } diff --git a/sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java b/sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java index 35bbfbf..04292e2 100644 --- a/sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java +++ b/sonar-runner-dist/src/test/java/org/sonar/runner/ConfTest.java @@ -100,8 +100,12 @@ public class ConfTest { assertThat(properties.getProperty("1.sonar.projectName")).isEqualTo("Module 1"); assertThat(properties.getProperty("1.11.sonar.projectName")).isEqualTo("Module 11"); + assertThat(properties.getProperty("1.11.111.sonar.projectName")).isEqualTo("Module 111"); assertThat(properties.getProperty("1.12.sonar.projectName")).isEqualTo("Module 12"); assertThat(properties.getProperty("2.sonar.projectName")).isEqualTo("Module 2"); + + // SONARUNNER-125 + assertThat(properties.getProperty("11.111.sonar.projectName")).isNull(); } @Test diff --git a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module111/placeholder.txt b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module111/placeholder.txt new file mode 100644 index 0000000..e69de29 diff --git a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module112/placeholder.txt b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/module112/placeholder.txt new file mode 100644 index 0000000..e69de29 diff --git a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/placeholder.txt b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/module1/module11/placeholder.txt deleted file mode 100644 index e69de29..0000000 diff --git a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties index 5271377..56eb032 100644 --- a/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties +++ b/sonar-runner-dist/src/test/resources/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project/sonar-project.properties @@ -4,6 +4,12 @@ sonar.modules=1,2 1.sonar.modules=11,12 1.11.sonar.projectBaseDir=module11 1.11.sonar.projectName=Module 11 +1.11.sonar.modules=111,112 +1.11.111.sonar.projectBaseDir=module111 +1.11.111.sonar.projectName=Module 111 +1.11.112.sonar.projectBaseDir=module112 +1.11.112.sonar.projectName=Module 112 + 1.12.sonar.projectBaseDir=module12 1.12.sonar.projectName=Module 12