*/
static ProjectDefinition convert(MavenProject pom) {
String key = new StringBuilder().append(pom.getGroupId()).append(":").append(pom.getArtifactId()).toString();
- ProjectDefinition definition = ProjectDefinition.create(pom.getModel().getProperties());
- definition.setKey(key)
+ ProjectDefinition definition = ProjectDefinition.create();
+ // IMPORTANT NOTE : reference on properties from POM model must not be saved, instead they should be copied explicitly - see SONAR-2896
+ definition
+ .setProperties(pom.getModel().getProperties())
+ .setKey(key)
.setVersion(pom.getVersion())
.setName(pom.getName())
.setDescription(pom.getDescription())
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);
}
public File getBaseDir() {
return baseDir;
}
+
public ProjectDefinition setWorkDir(File workDir) {
this.workDir = workDir;
return this;
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;
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));
return this;
}
-
/**
* Adding source files is possible only if no source directories have been set.
* Absolute path or relative path from project base dir.
return Arrays.asList(StringUtils.split(sources, SEPARATOR));
}
-
public List<String> getBinaries() {
String sources = properties.getProperty(BINARIES_PROPERTY, "");
return Arrays.asList(StringUtils.split(sources, SEPARATOR));
return addBinaryDir(f.getAbsolutePath());
}
-
public List<String> getLibraries() {
String sources = properties.getProperty(LIBRARIES_PROPERTY, "");
return Arrays.asList(StringUtils.split(sources, SEPARATOR));