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.
| Constructor and Description |
|---|
JarState(Collection<String> mavenCoordinates,
FileSignature fileSignature,
Set<File> jars)
Deprecated.
|
JarState(String mavenCoordinate,
FileSignature fileSignature,
Set<File> jars)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static JarState |
from(Collection<String> mavenCoordinates,
Provisioner provisioner)
Provisions the given maven coordinates and their transitive dependencies.
|
static JarState |
from(String mavenCoordinate,
Provisioner provisioner)
Provisions the given maven coordinate and its transitive dependencies.
|
ClassLoader |
getClassLoader()
Returns a classloader containing the only jars in this JarState.
|
ClassLoader |
getClassLoader(Serializable key)
Returns a classloader containing the only jars in this JarState.
|
Set<String> |
getMavenCoordinates()
Returns unmodifiable view on sorted Maven coordinates
|
static JarState |
withoutTransitives(Collection<String> mavenCoordinates,
Provisioner provisioner)
Provisions the given maven coordinates without their transitive dependencies.
|
@Deprecated public JarState(String mavenCoordinate, FileSignature fileSignature, Set<File> jars)
@Deprecated public JarState(Collection<String> mavenCoordinates, FileSignature fileSignature, Set<File> jars)
public static JarState from(String mavenCoordinate, Provisioner provisioner) throws IOException
Provisions the given maven coordinate and its transitive dependencies.
IOExceptionpublic static JarState from(Collection<String> mavenCoordinates, Provisioner provisioner) throws IOException
Provisions the given maven coordinates and their transitive dependencies.
IOExceptionpublic static JarState withoutTransitives(Collection<String> mavenCoordinates, Provisioner provisioner) throws IOException
Provisions the given maven coordinates without their transitive dependencies.
IOExceptionpublic 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.
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.