}
}
String[] moduleIds = getListFromProperty(currentModuleProperties, PROPERTY_MODULES);
- // Sort module by reverse lexicographic order to avoid issue when one module id is a prefix of another one
+ // Sort modules by reverse lexicographic order to avoid issue when one module id is a prefix of another one
Arrays.sort(moduleIds);
ArrayUtils.reverse(moduleIds);
propertiesByModuleIdPath.put(currentModuleIdPath, currentModuleProperties);
for (String moduleId : moduleIds) {
+ if ("sonar".equals(moduleId)) {
+ throw MessageException.of("'sonar' is not a valid module id. Please check property '" + PROPERTY_MODULES + "'.");
+ }
String subModuleIdPath = currentModuleIdPath.isEmpty() ? moduleId : (currentModuleIdPath + "." + moduleId);
extractPropertiesByModule(propertiesByModuleIdPath, moduleId, subModuleIdPath, currentModuleProperties);
}
loadProjectDefinition("multi-module-duplicate-id");
}
+ @Test
+ public void sonarModuleIdIsForbidden() {
+ thrown.expect(MessageException.class);
+ thrown.expectMessage("'sonar' is not a valid module id. Please check property 'sonar.modules'.");
+
+ loadProjectDefinition("multi-module-sonar-module");
+ }
+
@Test
public void modulesRepeatedIds() {
ProjectDefinition rootProject = loadProjectDefinition("multi-module-repeated-id");
--- /dev/null
+sonar.projectKey=com.foo.project
+sonar.projectName=Foo Project
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.projectDescription=Description of Foo Project
+
+sonar.sources=sources
+sonar.tests=tests
+sonar.binaries=target/classes
+
+sonar.modules=module1,sonar
+
+module1.sonar.sources=src
+
+# Unable to know to which module belong this property
+sonar.sonar.sources=foo