@SuppressWarnings("ResultOfMethodCallIgnored")
    private void copyFromJarToLocation(
        final JarFile jarFile,
        final JarEntry entry,
        final String fromRoot,
        final File toRoot
    ) throws IOException {
        String destinationName = entry.getName().replaceFirst(fromRoot, "");
        File newFile = new File(toRoot, destinationName);

        log.debug("Copying resource {} from JAR file {}", fromRoot, jarFile.getName());

        if (!entry.isDirectory()) {
            // Create parent directories
            Path parent = newFile.getAbsoluteFile().toPath().getParent();
            parent.toFile().mkdirs();
            newFile.deleteOnExit();

            try (InputStream is = jarFile.getInputStream(entry)) {
                Files.copy(is, newFile.toPath());
            } catch (IOException e) {
                log.error(
                    "Failed to extract classpath resource " + entry.getName() + " from JAR file " + jarFile.getName(),
                    e
                );
                throw e;
            }
        }
    }
Extract a file or directory tree from a JAR file to a temporary location.
This allows Docker to mount classpath resources as files.

@param hostPath the path on the host, expected to be of the format 'file:/path/to/some.jar!/classpath/path/to/resource'
@return the path of the temporary file/directory
core/src/main/java/org/testcontainers/utility/MountableFile.java