Skip to content

Commit

Permalink
Use getVersion for spring-cloud consul
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielFran committed Feb 3, 2022
1 parent d164fd0 commit 2dd1ed4
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static tech.jhipster.lite.generator.server.springboot.springcloud.consul.domain.Consul.*;

import tech.jhipster.lite.common.domain.Base64Utils;
import tech.jhipster.lite.error.domain.GeneratorException;
import tech.jhipster.lite.generator.buildtool.generic.domain.BuildToolService;
import tech.jhipster.lite.generator.project.domain.Project;
import tech.jhipster.lite.generator.project.domain.ProjectRepository;
Expand All @@ -31,11 +32,19 @@ public void init(Project project) {

@Override
public void addDependencies(Project project) {
buildToolService.addProperty(project, "spring-cloud.version", getSpringCloudVersion());
buildToolService.addDependencyManagement(project, springCloudDependencyManagement());
buildToolService.addDependency(project, springCloudBootstrapDependency());
buildToolService.addDependency(project, springCloudConsulConfigDependency());
buildToolService.addDependency(project, springCloudConsulDiscoveryDependency());
this.buildToolService.getVersion(project, "spring-cloud")
.ifPresentOrElse(
version -> {
buildToolService.addProperty(project, "spring-cloud.version", version);
buildToolService.addDependencyManagement(project, springCloudDependencyManagement());
buildToolService.addDependency(project, springCloudBootstrapDependency());
buildToolService.addDependency(project, springCloudConsulConfigDependency());
buildToolService.addDependency(project, springCloudConsulDiscoveryDependency());
},
() -> {
throw new GeneratorException("Spring Cloud version not found");
}
);
}

@Override
Expand Down

0 comments on commit 2dd1ed4

Please sign in to comment.