Browse Source

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
pull/43333/head
Andy Wilkinson 1 year ago
parent
commit
d924e4d999
  1. 5
      spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle

5
spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle

@ -234,7 +234,10 @@ publishing.publications.withType(MavenPublication) { @@ -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')
}
}
}
}

Loading…
Cancel
Save