Polish "Support provided-scope libraries when extracting an executable war"

Make the extracted war runnable with java -jar: move root content
such as static files and JSPs to META-INF/resources/, name the
application jar *.jar, and write the META-INF/ directory entry
before the manifest.

Fail early when a library and a provided library share a file
name, as both would be extracted to the same location. Assert the
Spring-Boot-Lib-Provided attribute in the Maven and Gradle tests
and document war extraction.

See gh-51372
This commit is contained in:
Moritz Halbritter
2026-10-08 16:04:23 +02:00
parent a31ee9f29b
commit 1dd4bee51c
19 changed files with 343 additions and 75 deletions
@@ -33,6 +33,10 @@ $ java -jar my-app/my-app.jar
After startup, you should not expect any differences in execution time between running an executable jar and running an extracted jar.
NOTE: An executable war can be extracted in the same way.
The result is a jar, for example `my-app/my-app.jar`, that is meant to be run with `java -jar`.
Content from the root of the war, such as static files and JSPs from `src/main/webapp`, is moved to `META-INF/resources/` in the extracted jar.
TIP: Run `java -Djarmode=tools -jar my-app.jar help extract` to see all possible options.