diff --git a/spring-cloud-release-tools-spring/pom.xml b/spring-cloud-release-tools-spring/pom.xml
index 9a356461..f2144f99 100644
--- a/spring-cloud-release-tools-spring/pom.xml
+++ b/spring-cloud-release-tools-spring/pom.xml
@@ -36,10 +36,14 @@
5.0.3
true
+
+
+
+
+
- com.esotericsoftware.yamlbeans
- yamlbeans
- 1.13
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-yaml
diff --git a/spring-cloud-release-tools-spring/src/main/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesUpdater.java b/spring-cloud-release-tools-spring/src/main/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesUpdater.java
index 8e6f559c..12fc0bf4 100644
--- a/spring-cloud-release-tools-spring/src/main/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesUpdater.java
+++ b/spring-cloud-release-tools-spring/src/main/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesUpdater.java
@@ -1,20 +1,20 @@
package org.springframework.cloud.release.internal.spring;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
import java.util.Map;
+import java.util.Properties;
+import java.util.stream.Collectors;
-import com.esotericsoftware.yamlbeans.YamlReader;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.config.YamlMapFactoryBean;
+import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
import org.springframework.cloud.release.internal.ReleaserProperties;
import org.springframework.cloud.release.internal.ReleaserPropertiesAware;
import org.springframework.context.ApplicationContext;
+import org.springframework.core.io.FileSystemResource;
/**
* @author Marcin Grzejszczak
@@ -41,10 +41,16 @@ class ReleaserPropertiesUpdater {
File releaserConfig = new File(clonedProjectFromOrg, "config/releaser.yml");
if (releaserConfig.exists()) {
try {
- Object read = new YamlReader(new FileReader(releaserConfig)).read();
+ YamlPropertiesFactoryBean yamlProcessor = new YamlPropertiesFactoryBean();
+ yamlProcessor.setResources(new FileSystemResource(releaserConfig));
+ Properties properties = yamlProcessor.getObject();
ReleaserProperties releaserProperties = new Binder(
- new MapConfigurationPropertySource((Map) read))
- .bind("releaser", ReleaserProperties.class).get();
+ new MapConfigurationPropertySource(properties.entrySet().stream().collect(
+ Collectors.toMap(
+ e -> e.getKey().toString(),
+ e -> e.getValue().toString()
+ )
+ ))).bind("releaser", ReleaserProperties.class).get();
log.info("config/releaser.yml found. Will update the current properties");
copy.setMaven(releaserProperties.getMaven());
copy.setGradle(releaserProperties.getGradle());
diff --git a/spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesIntegrationTests.java b/spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesIntegrationTests.java
index 243a5114..b1727c89 100644
--- a/spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesIntegrationTests.java
+++ b/spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesIntegrationTests.java
@@ -53,7 +53,24 @@ public class ReleaserPropertiesIntegrationTests {
ReleaserPropertiesHaving having = ((ReleaserPropertiesHaving) aware);
BDDAssertions.then(having.properties.getPom().getBranch()).isEqualTo("barrrr");
BDDAssertions.then(having.properties.getMaven().getBuildCommand()).isEqualTo("./scripts/noIntegration.sh");
- });
+ });
+ }
+
+ @Test public void should_update_properties_including_existing_releaser_config_for_netflix() {
+ ReleaserProperties properties = new ReleaserProperties();
+ properties.getPom().setBranch("bazzzz");
+ URL resource = ReleaserPropertiesIntegrationTests.class
+ .getResource("/projects/project-with-netflix-config");
+
+ new ReleaserPropertiesUpdater(this.context).updateProperties(properties,
+ new File(resource.getFile()));
+
+ BDDAssertions.then(this.propertiesAware).hasSize(2);
+ this.propertiesAware.forEach(aware -> {
+ ReleaserPropertiesHaving having = ((ReleaserPropertiesHaving) aware);
+ BDDAssertions.then(having.properties.getPom().getBranch()).isEqualTo("bazzzz");
+ BDDAssertions.then(having.properties.getMaven().getBuildCommand()).isEqualTo("./scripts/build.sh {{systemProps}}");
+ });
}
@Configuration
diff --git a/spring-cloud-release-tools-spring/src/test/resources/projects/project-with-netflix-config/config/releaser.yml b/spring-cloud-release-tools-spring/src/test/resources/projects/project-with-netflix-config/config/releaser.yml
new file mode 100644
index 00000000..304529b2
--- /dev/null
+++ b/spring-cloud-release-tools-spring/src/test/resources/projects/project-with-netflix-config/config/releaser.yml
@@ -0,0 +1,3 @@
+releaser:
+ maven:
+ buildCommand: ./scripts/build.sh {{systemProps}}
\ No newline at end of file