public static JarPluginLoader load(
            final Path jarPath,
            final List<Path> dependencyJarPaths,
            final PluginClassLoaderFactory classLoaderFactory)
            throws InvalidJarPluginException {
        final JarURLConnection connection = openJarUrlConnection(jarPath);
        final Manifest manifest = loadJarPluginManifest(connection, jarPath);
        final Attributes manifestAttributes = manifest.getMainAttributes();
        final int spiVersion = getPluginSpiVersionFromManifest(manifestAttributes);

        if (spiVersion == 0) {
            final String mainClassName = getPluginMainClassNameFromManifest(manifestAttributes);
            final Class mainClass = loadJarPluginMainClass(
                    jarPath, dependencyJarPaths, mainClassName, classLoaderFactory);
            return new JarPluginLoader(manifestAttributes, mainClass);
        }

        throw new InvalidJarPluginException("Unknown SPI version of JAR plugin: " + spiVersion);
    }
JarPluginLoader loads a JAR-based Embulk plugin class.

It implements {@code AutoCloseable} so that it can load the contents lazily in the future.
It is recommended to try-with-resources to use this class.
embulk-core/src/main/java/org/embulk/plugin/jar/JarPluginLoader.java