diff --git a/initializr-service/src/main/java/io/spring/initializr/service/extension/SpringCloudCompatibilityRequestPostProcessor.java b/initializr-service/src/main/java/io/spring/initializr/service/extension/SpringCloudCompatibilityRequestPostProcessor.java deleted file mode 100644 index 64ceb5d1..00000000 --- a/initializr-service/src/main/java/io/spring/initializr/service/extension/SpringCloudCompatibilityRequestPostProcessor.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.initializr.service.extension; - -import io.spring.initializr.generator.ProjectRequest; -import io.spring.initializr.generator.ProjectRequestPostProcessor; -import io.spring.initializr.metadata.InitializrMetadata; -import io.spring.initializr.util.Version; - -import org.springframework.stereotype.Component; - -/** - * Temporary adapter for Spring Cloud to use a compatible Spring Boot version. - * - * @author Stephane Nicoll - */ -@Component -class SpringCloudCompatibilityRequestPostProcessor - implements ProjectRequestPostProcessor { - - private static final Version VERSION_2_0_0_M4 = Version.parse("2.0.0.M4"); - - @Override - public void postProcessAfterResolution(ProjectRequest request, InitializrMetadata metadata) { - Version requestVersion = Version.safeParse(request.getBootVersion()); - if (isIncompatibleMilestone(requestVersion) && hasSpringCloud(request)) { - request.setBootVersion("2.0.0.M3"); - } - } - - private boolean isIncompatibleMilestone(Version requestVersion) { - return VERSION_2_0_0_M4.compareTo(requestVersion) <= 0 - && "M".equals(requestVersion.getQualifier().getQualifier()); - } - - private boolean hasSpringCloud(ProjectRequest request) { - return request.getResolvedDependencies().stream() - .anyMatch(d -> d.getId().startsWith("cloud-")); - } - -} diff --git a/initializr-service/src/main/resources/application.yml b/initializr-service/src/main/resources/application.yml index b422fc04..4b22fd5a 100644 --- a/initializr-service/src/main/resources/application.yml +++ b/initializr-service/src/main/resources/application.yml @@ -47,7 +47,7 @@ initializr: version: Edgware.RC1 repositories: spring-milestones - versionRange: "[2.0.0.M2, 2.0.0.BUILD-SNAPSHOT)" - version: Finchley.M2 + version: Finchley.M3 repositories: spring-milestones - versionRange: "2.0.0.BUILD-SNAPSHOT" version: Finchley.BUILD-SNAPSHOT diff --git a/initializr-service/src/test/java/io/spring/initializr/service/extension/SpringCloudCompatibilityRequestPostProcessorTests.java b/initializr-service/src/test/java/io/spring/initializr/service/extension/SpringCloudCompatibilityRequestPostProcessorTests.java deleted file mode 100644 index 11ad8403..00000000 --- a/initializr-service/src/test/java/io/spring/initializr/service/extension/SpringCloudCompatibilityRequestPostProcessorTests.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.initializr.service.extension; - -import io.spring.initializr.generator.ProjectRequest; -import org.junit.Test; - -/** - * Tests for {@link SpringCloudCompatibilityRequestPostProcessor}. - * - * @author Stephane Nicoll - */ -public class SpringCloudCompatibilityRequestPostProcessorTests - extends AbstractRequestPostProcessorTests { - - @Test - public void springBoot2MilestoneDowngradedWithSpringCloud() { - ProjectRequest request = createProjectRequest("cloud-config-server"); - request.setBootVersion("2.0.0.M7"); - generateMavenPom(request) - .hasSpringBootParent("2.0.0.M3"); - } - - @Test - public void springBoot2SnapshotWithSpringCloudUsesLatest() { - ProjectRequest request = createProjectRequest("cloud-config-server"); - request.setBootVersion("2.0.0.BUILD-SNAPSHOT"); - generateMavenPom(request) - .hasSpringBootParent("2.0.0.BUILD-SNAPSHOT"); - } - - @Test - public void springBoot2MilestoneNotDowngradedWithoutSpringCloud() { - ProjectRequest request = createProjectRequest("web"); - request.setBootVersion("2.0.0.M7"); - generateMavenPom(request) - .hasSpringBootParent("2.0.0.M7"); - } - - @Test - public void onlySpringBoot2MilestoneHandled() { - ProjectRequest request = createProjectRequest("cloud-config-server"); - request.setBootVersion("2.0.0.RC1"); - generateMavenPom(request) - .hasSpringBootParent("2.0.0.RC1"); - } - - @Test - public void onlySpringBoot2Handled() { - ProjectRequest request = createProjectRequest("cloud-config-server"); - request.setBootVersion("1.5.7.RELEASE"); - generateMavenPom(request) - .hasSpringBootParent("1.5.7.RELEASE"); - } - -} \ No newline at end of file