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
This commit is contained in:
Andy Wilkinson
2024-11-26 13:42:03 +00:00
parent bb3651b7d1
commit d924e4d999

View File

@@ -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')
}
}
}
}