File parentBaseDir = new File(parentProps.getProperty(PROPERTY_PROJECT_BASEDIR));
if (parentProps.containsKey(PROPERTY_MODULES)) {
for (String module : getListFromProperty(parentProps, PROPERTY_MODULES)) {
- Properties moduleProps = extractModuleProperties(module, parentProps);
+ Properties moduleProps = extractModuleProperties(module, projectProps);
moduleProps = loadChildConfigFile(parentBaseDir, moduleProps, module);
// the child project may have children as well
assertThat(properties.getProperty("module2.sonar.projectName")).isEqualTo("Module 2");
}
+ @Test
+ public void shouldSupportDeepModuleConfigurationInRoot() throws Exception {
+ File projectHome = new File(getClass().getResource("/org/sonar/runner/ConfTest/shouldSupportDeepModuleConfigurationInRoot/project").toURI());
+ args.setProperty("project.home", projectHome.getCanonicalPath());
+
+ Properties properties = conf.properties();
+
+ assertThat(properties.getProperty("1.sonar.projectName")).isEqualTo("Module 1");
+ assertThat(properties.getProperty("11.sonar.projectName")).isEqualTo("Module 11");
+ assertThat(properties.getProperty("12.sonar.projectName")).isEqualTo("Module 12");
+ assertThat(properties.getProperty("2.sonar.projectName")).isEqualTo("Module 2");
+ }
+
@Test
public void shouldLoadModuleConfigurationOverrideBasedir() throws Exception {
File projectHome = new File(getClass().getResource("/org/sonar/runner/ConfTest/shouldLoadModuleConfigurationOverrideBasedir/project").toURI());
--- /dev/null
+sonar.modules=1,2
+1.sonar.projectName=Module 1
+1.sonar.projectBaseDir=module1
+1.sonar.modules=11,12
+11.sonar.projectBaseDir=module11
+11.sonar.projectName=Module 11
+12.sonar.projectBaseDir=module12
+12.sonar.projectName=Module 12
+
+2.sonar.projectName=Module 2
+2.sonar.projectBaseDir=module2
\ No newline at end of file