Prevent project prior to Spring Boot 1.5 to be generated

See gh-763
This commit is contained in:
Stephane Nicoll
2018-11-29 10:35:06 +01:00
parent f5d440506e
commit 185e18cd5e
2 changed files with 17 additions and 0 deletions

View File

@@ -64,6 +64,8 @@ public class ProjectGenerator {
private static final Logger log = LoggerFactory.getLogger(ProjectGenerator.class);
private static final Version VERSION_1_5_0 = Version.parse("1.5.0.RELEASE");
private static final Version VERSION_2_0_0 = Version.parse("2.0.0.RELEASE");
@Autowired
@@ -341,6 +343,11 @@ public class ProjectGenerator {
// request resolved so we can log what has been requested
Version bootVersion = Version.safeParse(request.getBootVersion());
if (bootVersion.compareTo(VERSION_1_5_0) < 0) {
throw new InvalidProjectRequestException("Invalid Spring Boot version "
+ bootVersion + " must be 1.5.0 or higher");
}
List<Dependency> dependencies = request.getResolvedDependencies();
List<String> dependencyIds = dependencies.stream().map(Dependency::getId)
.collect(Collectors.toList());

View File

@@ -855,6 +855,16 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
}
}
@Test
public void invalidSpringBootVersion() {
ProjectRequest request = createProjectRequest("web");
request.setType("maven-project");
request.setBootVersion("1.2.3.M4");
this.thrown.expect(InvalidProjectRequestException.class);
this.thrown.expectMessage("1.2.3.M4");
this.projectGenerator.generateMavenPom(request);
}
@Test
public void kotlinWithMavenUseJpaFacetHasJpaKotlinPlugin() {
applyJpaMetadata(true);