Skip to content

Commit 31042bf

Browse files
committed
Test inclusion of system scope dependencies in repackaged war
Closes gh-22503
1 parent 48bfdc1 commit 31042bf

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.springframework.boot.maven.it</groupId>
6+
<artifactId>war-system-scope</artifactId>
7+
<version>0.0.1.BUILD-SNAPSHOT</version>
8+
<packaging>war</packaging>
9+
<properties>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<maven.compiler.source>@java.version@</maven.compiler.source>
12+
<maven.compiler.target>@java.version@</maven.compiler.target>
13+
</properties>
14+
<build>
15+
<plugins>
16+
<plugin>
17+
<groupId>@project.groupId@</groupId>
18+
<artifactId>@project.artifactId@</artifactId>
19+
<version>@project.version@</version>
20+
<executions>
21+
<execution>
22+
<goals>
23+
<goal>repackage</goal>
24+
</goals>
25+
<configuration>
26+
<includeSystemScope>true</includeSystemScope>
27+
</configuration>
28+
</execution>
29+
</executions>
30+
</plugin>
31+
<plugin>
32+
<groupId>org.apache.maven.plugins</groupId>
33+
<artifactId>maven-war-plugin</artifactId>
34+
<version>@maven-war-plugin.version@</version>
35+
<configuration>
36+
<archive>
37+
<manifestEntries>
38+
<Not-Used>Foo</Not-Used>
39+
</manifestEntries>
40+
</archive>
41+
</configuration>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
<dependencies>
46+
<dependency>
47+
<groupId>org.springframework</groupId>
48+
<artifactId>spring-context</artifactId>
49+
<version>@spring-framework.version@</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>jakarta.servlet</groupId>
53+
<artifactId>jakarta.servlet-api</artifactId>
54+
<version>@jakarta-servlet.version@</version>
55+
<scope>provided</scope>
56+
</dependency>
57+
<dependency>
58+
<groupId>com.example</groupId>
59+
<artifactId>sample</artifactId>
60+
<version>1.0.0</version>
61+
<scope>system</scope>
62+
<systemPath>${project.basedir}/sample-1.0.0.jar</systemPath>
63+
</dependency>
64+
</dependencies>
65+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2012-2020 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.test;
18+
19+
public class SampleApplication {
20+
21+
public static void main(String[] args) {
22+
}
23+
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<html></html>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2012-2020 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import java.io.*;
18+
import org.springframework.boot.maven.*;
19+
20+
File f = new File(basedir, "target/war-system-scope-0.0.1.BUILD-SNAPSHOT.war")
21+
new Verify.WarArchiveVerification(f) {
22+
@Override
23+
protected void verifyZipEntries(Verify.ArchiveVerifier verifier) throws Exception {
24+
super.verifyZipEntries(verifier)
25+
verifier.assertHasEntryNameStartingWith("WEB-INF/lib-provided/sample-1.0.0.jar")
26+
}
27+
}.verify()

0 commit comments

Comments
 (0)