diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2013-01-07 12:03:52 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2013-01-07 12:03:52 +0100 |
commit | 51bd30be5e9e33dcf26126b74ace304ee839d1e0 (patch) | |
tree | cf50f6769d9058c05bbfc0379af54a3c4b609c03 /src/main | |
parent | eb4a343f2252588057f9d5e86f5382a270ed1a69 (diff) | |
download | sonar-scanner-cli-51bd30be5e9e33dcf26126b74ace304ee839d1e0.tar.gz sonar-scanner-cli-51bd30be5e9e33dcf26126b74ace304ee839d1e0.zip |
SONARPLUGINS-2297 The property sonar.sources should not be mandatory
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java b/src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java index 7e929ac..40e715f 100644 --- a/src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java +++ b/src/main/java/org/sonar/runner/internal/batch/SonarProjectBuilder.java @@ -90,12 +90,17 @@ public final class SonarProjectBuilder { private static final String DEF_VALUE_WORK_DIRECTORY = ".sonar"; /** - * Array of all mandatory properties required for a project. + * Array of all mandatory properties required for a project without child. */ - private static final String[] MANDATORY_PROPERTIES_FOR_PROJECT = {PROPERTY_PROJECT_BASEDIR, PROPERTY_PROJECT_KEY, PROPERTY_PROJECT_NAME, PROPERTY_PROJECT_VERSION, + private static final String[] MANDATORY_PROPERTIES_FOR_SIMPLE_PROJECT = {PROPERTY_PROJECT_BASEDIR, PROPERTY_PROJECT_KEY, PROPERTY_PROJECT_NAME, PROPERTY_PROJECT_VERSION, PROPERTY_SOURCES}; /** + * Array of all mandatory properties required for a project with children. + */ + private static final String[] MANDATORY_PROPERTIES_FOR_MULTIMODULE_PROJECT = {PROPERTY_PROJECT_BASEDIR, PROPERTY_PROJECT_KEY, PROPERTY_PROJECT_NAME, PROPERTY_PROJECT_VERSION}; + + /** * Array of all mandatory properties required for a child project before its properties get merged with its parent ones. */ private static final String[] MANDATORY_PROPERTIES_FOR_CHILD = {PROPERTY_PROJECT_KEY, PROPERTY_PROJECT_NAME}; @@ -125,7 +130,12 @@ public final class SonarProjectBuilder { } private ProjectDefinition defineProject(Properties properties, ProjectDefinition parent) { - checkMandatoryProperties(properties, MANDATORY_PROPERTIES_FOR_PROJECT); + if (properties.containsKey(PROPERTY_MODULES)) { + checkMandatoryProperties(properties, MANDATORY_PROPERTIES_FOR_MULTIMODULE_PROJECT); + } + else { + checkMandatoryProperties(properties, MANDATORY_PROPERTIES_FOR_SIMPLE_PROJECT); + } File baseDir = new File(properties.getProperty(PROPERTY_PROJECT_BASEDIR)); File workDir = null; if (parent == null) { |