When the `buildWorkspace` location in the
`spring-boot:build-image` Maven goal or `bootBuildImage` Gradle
task is configured to use a local bind source, the location
is passed to the CNB lifecycle without further processing by
Spring Boot. The lifecycle is in control of creating any files
in the specified location. Spring Boot tries to remove the
directories at the specified location after an image is
successfully created, but should not fail the image build
if the lifecycle has created files or directories with
permissions that keep them from being deleted successfully.
Fixes gh-40760
Update `Path` creation for nested locations to allow both UNC and classic
file references to be used. This commit attempts to align our URL
handling with that of standard file URLs. The `NestedLocation` class
no longer attempts to remove leading all `\` characters and instead
only removes the first `\` when the second char is `:`. This duplicates
the logic found in Java's own internal `WindowsUriSupport` class which
is used when calling `Path.of(url)` with a `file:` URL.
Fixes gh-40549
In order to support Java 22, we must use spring-core 6.1.x.
spring-core 6.1.x is a multi-release jar so, in order to support Java
22, a version of Gradle that supports multi-release jars must be
used.
This commit adds a new variant to spring-boot-gradle-plugin for
modern versions of Gradle. When Gradle's plugin API version is 8.7 or
later, we use spring-core 6.1.x. spring-core 6.0.x is used at all
other times.
Closes gh-40074
Fix regression in `JarUrlConnection` where a NullPointerException could
be thrown internally causing performance issues.
When the SecurityManager is present, the following stack trace is
thrown:
java.lang.NullPointerException: Cannot invoke "java.net.URLConnection.getPermission()" because "this.jarFileConnection" is null
at org.springframework.boot.loader.net.protocol.jar.JarUrlConnection.getPermission(JarUrlConnection.java:175)
at java.base/jdk.internal.loader.URLClassPath.check(URLClassPath.java:553)
at java.base/jdk.internal.loader.URLClassPath$Loader.findResource(URLClassPath.java:612)
at java.base/jdk.internal.loader.URLClassPath.findResource(URLClassPath.java:296)
at java.base/java.net.URLClassLoader$2.run(URLClassLoader.java:629)
at java.base/java.net.URLClassLoader$2.run(URLClassLoader.java:627)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.net.URLClassLoader.findResource(URLClassLoader.java:626)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.findResource(JarUrlClassLoader.java:70)
at java.base/java.lang.ClassLoader.getResource(ClassLoader.java:1403)
at java.base/java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:290)
at java.base/java.lang.Class.getResourceAsStream(Class.java:2850)
See gh-39856