Class JarState

java.lang.Object
com.diffplug.spotless.JarState
All Implemented Interfaces:
Serializable

public final class JarState extends Object implements Serializable
Grabs a jar and its dependencies from maven, and makes it easy to access the collection in a classloader.

Serializes the full state of the jar, so it can catch changes in a SNAPSHOT version.

See Also:
  • Method Details

    • promise

      public static JarState.Promised promise(ThrowingEx.Supplier<JarState> supplier)
    • from

      public static JarState from(String mavenCoordinate, Provisioner provisioner) throws IOException
      Provisions the given maven coordinate and its transitive dependencies.
      Throws:
      IOException
    • from

      public static JarState from(Collection<String> mavenCoordinates, Provisioner provisioner) throws IOException
      Provisions the given maven coordinates and their transitive dependencies.
      Throws:
      IOException
    • withoutTransitives

      public static JarState withoutTransitives(Collection<String> mavenCoordinates, Provisioner provisioner) throws IOException
      Provisions the given maven coordinates without their transitive dependencies.
      Throws:
      IOException
    • preserveOrder

      public static JarState preserveOrder(Collection<File> jars) throws IOException
      Wraps the given collection of a files as a JarState, maintaining the order in the Collection.
      Throws:
      IOException
    • getClassLoader

      public ClassLoader getClassLoader()
      Returns a classloader containing the only jars in this JarState. Look-up of classes in the org.slf4j package are not taken from the JarState, but instead redirected to the class loader of this class to enable passthrough logging.
      The lifetime of the underlying cacheloader is controlled by SpotlessCache.
    • getClassLoader

      public ClassLoader getClassLoader(Serializable key)
      Returns a classloader containing the only jars in this JarState. Look-up of classes in the org.slf4j package are not taken from the JarState, but instead redirected to the class loader of this class to enable passthrough logging.
      The lifetime of the underlying cacheloader is controlled by SpotlessCache.