From d924e4d9998945933a4a9947a6ca776e303db1ea Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 26 Nov 2024 13:42:03 +0000 Subject: [PATCH] Mark shaded application's jar as multi-release by default Spring Framework now uses a multi-release jar for its virtual thread support. If the shaded jar is not marked as being a multi-release jar and virtual threads are enabled, the application will fail to start as the Java 21+ virtual threads delegate will be unavailable. This commit updates the starter parent's default configuration for the Maven Shade plugin to set Multi-Release: true in the application's manifest. Closes gh-43284 --- .../spring-boot-starter-parent/build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle b/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle index 4c85421b140..6c4c81d4c4f 100644 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle +++ b/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle @@ -234,7 +234,10 @@ publishing.publications.withType(MavenPublication) { } transformer(implementation: 'org.apache.maven.plugins.shade.resource.ServicesResourceTransformer') transformer(implementation: 'org.apache.maven.plugins.shade.resource.ManifestResourceTransformer') { - delegate.mainClass('${start-class}') + manifestEntries { + delegate.'Main-Class'('${start-class}') + delegate.'Multi-Release'('true') + } } } }