Fixed overriding of properties

This commit is contained in:
Marcin Grzejszczak
2018-10-16 10:50:24 +02:00
parent 8a10d70ac3
commit 1fa3f9ebe7
5 changed files with 241 additions and 14 deletions

View File

@@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.BeanUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.StringUtils;
@@ -518,4 +519,29 @@ public class ReleaserProperties {
+ this.sagan + ", fixedVersions=" + this.fixedVersions + ", metaRelease="
+ this.metaRelease + '}';
}
public ReleaserProperties copy() {
ReleaserProperties copy = new ReleaserProperties();
copy.setFixedVersions(new HashMap<>(this.fixedVersions));
copy.setWorkingDir(this.workingDir);
Git git = new Git();
BeanUtils.copyProperties(this.git, git);
copy.setGit(git);
Gradle gradle = new Gradle();
BeanUtils.copyProperties(this.gradle, gradle);
copy.setGradle(gradle);
Maven maven = new Maven();
BeanUtils.copyProperties(this.maven, maven);
copy.setMaven(maven);
MetaRelease metaRelease = new MetaRelease();
BeanUtils.copyProperties(this.metaRelease, metaRelease);
copy.setMetaRelease(metaRelease);
Pom pom = new Pom();
BeanUtils.copyProperties(this.pom, pom);
copy.setPom(pom);
Sagan sagan = new Sagan();
BeanUtils.copyProperties(this.sagan, sagan);
copy.setSagan(sagan);
return copy;
}
}