diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-10-12 13:50:41 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-10-12 17:11:34 +0400 |
commit | fa1b8382d36c931be2cc5dcbfb62062d458c4308 (patch) | |
tree | 90216b601f3f1d67819cd6f292a541073807bc9c /sonar-plugin-api/src | |
parent | 1157d48769148780ad46699d0bae8ddb349b60bf (diff) | |
download | sonarqube-fa1b8382d36c931be2cc5dcbfb62062d458c4308.tar.gz sonarqube-fa1b8382d36c931be2cc5dcbfb62062d458c4308.zip |
SONAR-2896 Fix ability to configure Maven plugins under Maven 2.x
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java index bc0e9163fcf..4a5264a33e1 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java @@ -58,6 +58,13 @@ public final class ProjectDefinition implements BatchComponent { this.properties = p; } + /** + * @deprecated in 2.12, because it uses external object to represent internal state. + * To ensure backward-compatibility with Ant task this method cannot clone properties, + * so other callers must explicitly make clone of properties before passing into this method. + * Thus better to use {@link #create()} with combination of other methods like {@link #setProperties(Properties)} and {@link #setProperty(String, String)}. + */ + @Deprecated public static ProjectDefinition create(Properties properties) { return new ProjectDefinition(properties); } @@ -74,6 +81,7 @@ public final class ProjectDefinition implements BatchComponent { public File getBaseDir() { return baseDir; } + public ProjectDefinition setWorkDir(File workDir) { this.workDir = workDir; return this; @@ -87,6 +95,16 @@ public final class ProjectDefinition implements BatchComponent { return properties; } + /** + * Copies specified properties into this object. + * + * @since 2.12 + */ + public ProjectDefinition setProperties(Properties properties) { + properties.putAll(properties); + return this; + } + public ProjectDefinition setProperty(String key, String value) { properties.setProperty(key, value); return this; @@ -204,7 +222,6 @@ public final class ProjectDefinition implements BatchComponent { return Arrays.asList(StringUtils.split(sources, SEPARATOR)); } - public List<String> getTestDirs() { String sources = properties.getProperty(TEST_DIRS_PROPERTY, ""); return Arrays.asList(StringUtils.split(sources, SEPARATOR)); @@ -246,7 +263,6 @@ public final class ProjectDefinition implements BatchComponent { return this; } - /** * Adding source files is possible only if no source directories have been set. * Absolute path or relative path from project base dir. @@ -273,7 +289,6 @@ public final class ProjectDefinition implements BatchComponent { return Arrays.asList(StringUtils.split(sources, SEPARATOR)); } - public List<String> getBinaries() { String sources = properties.getProperty(BINARIES_PROPERTY, ""); return Arrays.asList(StringUtils.split(sources, SEPARATOR)); @@ -293,7 +308,6 @@ public final class ProjectDefinition implements BatchComponent { return addBinaryDir(f.getAbsolutePath()); } - public List<String> getLibraries() { String sources = properties.getProperty(LIBRARIES_PROPERTY, ""); return Arrays.asList(StringUtils.split(sources, SEPARATOR)); |