Class JarState

  • All Implemented Interfaces:
    java.io.Serializable

    public final class JarState
    extends java.lang.Object
    implements java.io.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:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static JarState from​(java.lang.String mavenCoordinate, Provisioner provisioner)
      Provisions the given maven coordinate and its transitive dependencies.
      static JarState from​(java.util.Collection<java.lang.String> mavenCoordinates, Provisioner provisioner)
      Provisions the given maven coordinates and their transitive dependencies.
      java.lang.ClassLoader getClassLoader()
      Returns a classloader containing the only jars in this JarState.
      java.lang.ClassLoader getClassLoader​(java.io.Serializable key)
      Returns a classloader containing the only jars in this JarState.
      java.util.Set<java.lang.String> getMavenCoordinates()
      Deprecated.
      static JarState preserveOrder​(java.util.Collection<java.io.File> jars)
      Wraps the given collection of a files as a JarState, maintaining the order in the Collection.
      static JarState withoutTransitives​(java.util.Collection<java.lang.String> mavenCoordinates, Provisioner provisioner)
      Provisions the given maven coordinates without their transitive dependencies.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • from

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

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

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

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

        public java.lang.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 java.lang.ClassLoader getClassLoader​(java.io.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.
      • getMavenCoordinates

        @Deprecated
        public java.util.Set<java.lang.String> getMavenCoordinates()
        Deprecated.
        Returns unmodifiable view on sorted Maven coordinates