diff --git a/integration-test/spring-boot-loader-integration-tests/build.gradle b/integration-test/spring-boot-loader-integration-tests/build.gradle index 9803aaea9e0d..9da9ae26256d 100644 --- a/integration-test/spring-boot-loader-integration-tests/build.gradle +++ b/integration-test/spring-boot-loader-integration-tests/build.gradle @@ -82,6 +82,17 @@ tasks.register("buildSignedJarRsaApp", GradleBuild) { tasks = ["build"] } +tasks.register("syncWarAppSource", org.springframework.boot.build.SyncAppSource) { + sourceDirectory = file("spring-boot-loader-tests-war") + destinationDirectory = file(layout.buildDirectory.dir("spring-boot-loader-tests-war")) +} + +tasks.register("buildWarApp", GradleBuild) { + dependsOn syncWarAppSource, syncMavenRepository + dir = layout.buildDirectory.dir("spring-boot-loader-tests-war") + startParameter.buildCacheEnabled = false + tasks = ["build"] +} tasks.register("downloadJdk", Download) { def destFolder = new File(project.gradle.gradleUserHomeDir, "caches/springboot/downloads/jdk/oracle") @@ -105,5 +116,5 @@ tasks.named("processDockerTestResources").configure { } tasks.named("dockerTest").configure { - dependsOn buildApp, buildSignedJarApp, buildSignedJarRsaApp + dependsOn buildApp, buildWarApp, buildSignedJarApp, buildSignedJarRsaApp } diff --git a/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/build.gradle b/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/build.gradle new file mode 100644 index 000000000000..a3e0b11f58e6 --- /dev/null +++ b/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/build.gradle @@ -0,0 +1,41 @@ +/* + * Copyright 2012-present 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 + * + * https://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. + */ + +plugins { + id "war" + id "org.springframework.boot" +} + +java { + sourceCompatibility = '17' + targetCompatibility = '17' +} + +repositories { + maven { url = layout.projectDirectory.dir("../docker-test-maven-repository") } + mavenCentral() + spring.mavenRepositories() +} + +dependencies { + implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)) + implementation("org.springframework.boot:spring-boot-starter-webmvc") + + providedRuntime(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)) + providedRuntime("org.springframework.boot:spring-boot-starter-tomcat-runtime") + providedRuntime("org.glassfish.web:jakarta.servlet.jsp.jstl") + providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper") +} diff --git a/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/settings.gradle b/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/settings.gradle new file mode 100644 index 000000000000..d5cca12cf132 --- /dev/null +++ b/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/settings.gradle @@ -0,0 +1,31 @@ +/* + * Copyright 2012-present 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 + * + * https://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. + */ + +pluginManagement { + evaluate(new File("${gradle.parent.rootProject.rootDir}/buildSrc/SpringRepositorySupport.groovy")).apply(this) + repositories { + maven { url = layout.settingsDirectory.dir("../docker-test-maven-repository") } + mavenCentral() + spring.mavenRepositories() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule "org.springframework.boot:spring-boot-gradle-plugin:${requested.version}" + } + } + } +} diff --git a/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/src/main/java/org/springframework/boot/loaderwarapp/LoaderWarTestApplication.java b/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/src/main/java/org/springframework/boot/loaderwarapp/LoaderWarTestApplication.java new file mode 100644 index 000000000000..6d9e218ccf5a --- /dev/null +++ b/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/src/main/java/org/springframework/boot/loaderwarapp/LoaderWarTestApplication.java @@ -0,0 +1,36 @@ +/* + * Copyright 2012-present 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 + * + * https://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 org.springframework.boot.loaderwarapp; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +@SpringBootApplication +public class LoaderWarTestApplication extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(LoaderWarTestApplication.class); + } + + public static void main(String[] args) { + SpringApplication.run(LoaderWarTestApplication.class, args).close(); + } + +} diff --git a/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/src/main/webapp/WEB-INF/jsp/welcome.jsp b/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/src/main/webapp/WEB-INF/jsp/welcome.jsp new file mode 100644 index 000000000000..811f3e7d00f2 --- /dev/null +++ b/integration-test/spring-boot-loader-integration-tests/spring-boot-loader-tests-war/src/main/webapp/WEB-INF/jsp/welcome.jsp @@ -0,0 +1,13 @@ + + +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + +
+