diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/ReleaserProperties.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/ReleaserProperties.java index 18e5dc8a..6a10565f 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/ReleaserProperties.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/ReleaserProperties.java @@ -291,12 +291,12 @@ public class ReleaserProperties { /** * Command to be executed to build the project */ - private String buildCommand = "./mvnw clean install -B -Pdocs"; + private String buildCommand = "./mvnw clean install -B -Pdocs {{systemProps}}"; /** * Command to be executed to deploy a built project */ - private String deployCommand = "./mvnw deploy -DskipTests -B -Pfast,deploy"; + private String deployCommand = "./mvnw deploy -DskipTests -B -Pfast,deploy {{systemProps}}"; /** * Command to be executed to publish documentation. If present "{{version}}" will be replaced by the diff --git a/spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesUpdaterTests.java b/spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesUpdaterTests.java index 9cfc2a73..dd377023 100644 --- a/spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesUpdaterTests.java +++ b/spring-cloud-release-tools-spring/src/test/java/org/springframework/cloud/release/internal/spring/ReleaserPropertiesUpdaterTests.java @@ -1,6 +1,7 @@ package org.springframework.cloud.release.internal.spring; import java.io.File; +import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; @@ -17,16 +18,31 @@ import org.springframework.context.ApplicationContext; public class ReleaserPropertiesUpdaterTests { ApplicationContext context = BDDMockito.mock(ApplicationContext.class); + File relaserUpdater; + + public ReleaserPropertiesUpdaterTests() throws URISyntaxException { + this.relaserUpdater = new File(ReleaserPropertiesUpdaterTests.class + .getResource("/projects/releaser-updater/").toURI()); + } @Test public void should_update_properties() { + ReleaserProperties original = originalReleaserProperties(); Aware aware = new Aware(); BDDMockito.given(this.context.getBeansOfType(BDDMockito.any(Class.class))) .willReturn(beansOfType(aware)); ReleaserPropertiesUpdater updater = new ReleaserPropertiesUpdater(this.context); - updater.updateProperties(new ReleaserProperties(), new File(".")); + ReleaserProperties props = updater + .updateProperties(original, this.relaserUpdater); BDDAssertions.then(aware.properties).isNotNull(); + BDDAssertions.then(props.getMaven().getSystemProperties()).isEqualTo("-Dfoo=bar"); + } + + ReleaserProperties originalReleaserProperties() { + ReleaserProperties props = new ReleaserProperties(); + props.getMaven().setSystemProperties("-Dfoo=bar"); + return props; } private Map beansOfType(Aware aware) { diff --git a/spring-cloud-release-tools-spring/src/test/resources/projects/releaser-updater/config/releaser.yml b/spring-cloud-release-tools-spring/src/test/resources/projects/releaser-updater/config/releaser.yml new file mode 100644 index 00000000..6d9c27b1 --- /dev/null +++ b/spring-cloud-release-tools-spring/src/test/resources/projects/releaser-updater/config/releaser.yml @@ -0,0 +1,4 @@ +releaser.maven.buildCommand: ./scripts/noIntegration.sh +releaser.gradle.gradlePropsSubstitution: + verifierVersion: spring-cloud-contract + bootVersion: spring-boot \ No newline at end of file