From 31042bfc4980610b2b6bc3af4f66b7a2625a330d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 10 Nov 2020 13:59:23 +0000 Subject: [PATCH] Test inclusion of system scope dependencies in repackaged war Closes gh-22503 --- .../src/it/war-system-scope/pom.xml | 65 ++++++++++++++++++ .../src/it/war-system-scope/sample-1.0.0.jar | Bin 0 -> 425 bytes .../main/java/org/test/SampleApplication.java | 24 +++++++ .../src/main/webapp/index.html | 1 + .../src/it/war-system-scope/verify.groovy | 27 ++++++++ 5 files changed, 117 insertions(+) create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/pom.xml create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/sample-1.0.0.jar create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/src/main/java/org/test/SampleApplication.java create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/src/main/webapp/index.html create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/verify.groovy diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/pom.xml new file mode 100644 index 00000000000..442bad317df --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + org.springframework.boot.maven.it + war-system-scope + 0.0.1.BUILD-SNAPSHOT + war + + UTF-8 + @java.version@ + @java.version@ + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + repackage + + + true + + + + + + org.apache.maven.plugins + maven-war-plugin + @maven-war-plugin.version@ + + + + Foo + + + + + + + + + org.springframework + spring-context + @spring-framework.version@ + + + jakarta.servlet + jakarta.servlet-api + @jakarta-servlet.version@ + provided + + + com.example + sample + 1.0.0 + system + ${project.basedir}/sample-1.0.0.jar + + + diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/sample-1.0.0.jar b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/sample-1.0.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..99ae50b87eb3461e00be14ba6f7edd6bc66a6cc8 GIT binary patch literal 425 zcmWIWW@Zs#;Nak3SkSZ6g8>O}GO#fCx`sIFdiuHP|2xINz|0Wf&CUT*!30$nfK#&w zPz7AGucM!*n`>~0p0C?y-!rFuymj?1@_OrPojY@WbCAIm;|EWR^t^m^Jbf>gu43Vg zcp-UY_H2!eAL6QN&zERfJQo*zBCa}(VQTiLqK`$4U`PD*jr4N{THyl3AV+X9FaRAk z70m}MK-sj+oYVksMkWykRA0ip0P-a&fIA!HXLPN|7K8kV0JcCTTq}}~K_+l9;C3Lw XghN0k#JQ|&AW>!@To0t5fH({Q#~x31 literal 0 HcmV?d00001 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/src/main/java/org/test/SampleApplication.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/src/main/java/org/test/SampleApplication.java new file mode 100644 index 00000000000..ca2b9a2f0e5 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/src/main/java/org/test/SampleApplication.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012-2020 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.test; + +public class SampleApplication { + + public static void main(String[] args) { + } + +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/src/main/webapp/index.html b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/src/main/webapp/index.html new file mode 100644 index 00000000000..18ecdcb795c --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/src/main/webapp/index.html @@ -0,0 +1 @@ + diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/verify.groovy b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/verify.groovy new file mode 100644 index 00000000000..38d8516d8e9 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/war-system-scope/verify.groovy @@ -0,0 +1,27 @@ +/* + * Copyright 2012-2020 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. + */ + +import java.io.*; +import org.springframework.boot.maven.*; + +File f = new File(basedir, "target/war-system-scope-0.0.1.BUILD-SNAPSHOT.war") +new Verify.WarArchiveVerification(f) { + @Override + protected void verifyZipEntries(Verify.ArchiveVerifier verifier) throws Exception { + super.verifyZipEntries(verifier) + verifier.assertHasEntryNameStartingWith("WEB-INF/lib-provided/sample-1.0.0.jar") + } +}.verify()