public class ClassLoaderResolver
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
private java.util.Map<MavenCoordinate,java.lang.ClassLoader> |
classLoaders
A mapping of Maven coordinates to already existing class loaders.
|
private org.apache.maven.plugin.logging.Log |
log
The Maven log dispatcher.
|
private java.util.List<org.eclipse.aether.repository.RemoteRepository> |
remoteRepositories
A list of remote repositories available.
|
private org.eclipse.aether.RepositorySystem |
repositorySystem
The repository system to use.
|
private org.eclipse.aether.RepositorySystemSession |
repositorySystemSession
The repository system session to use.
|
Constructor and Description |
---|
ClassLoaderResolver(org.apache.maven.plugin.logging.Log log,
org.eclipse.aether.RepositorySystem repositorySystem,
org.eclipse.aether.RepositorySystemSession repositorySystemSession,
java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories)
Creates a new class loader resolver.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
private java.lang.ClassLoader |
doResolve(MavenCoordinate mavenCoordinate)
Resolves a Maven coordinate to a class loader that can load all of the coordinates classes.
|
java.lang.ClassLoader |
resolve(MavenCoordinate mavenCoordinate)
Resolves a Maven coordinate to a class loader that can load all of the coordinates classes.
|
private final org.apache.maven.plugin.logging.Log log
private final org.eclipse.aether.RepositorySystem repositorySystem
private final org.eclipse.aether.RepositorySystemSession repositorySystemSession
private final java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories
private final java.util.Map<MavenCoordinate,java.lang.ClassLoader> classLoaders
public ClassLoaderResolver(org.apache.maven.plugin.logging.Log log, org.eclipse.aether.RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystemSession repositorySystemSession, java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories)
log
- The Maven log dispatcher.repositorySystem
- The repository system to use.repositorySystemSession
- The repository system session to use.remoteRepositories
- A list of remote repositories available.public java.lang.ClassLoader resolve(MavenCoordinate mavenCoordinate) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
mavenCoordinate
- The Maven coordinate to resolve.org.apache.maven.plugin.MojoExecutionException
- If the user configuration results in an error.org.apache.maven.plugin.MojoFailureException
- If the plugin application raises an error.private java.lang.ClassLoader doResolve(MavenCoordinate mavenCoordinate) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
mavenCoordinate
- The Maven coordinate to resolve.org.apache.maven.plugin.MojoExecutionException
- If the user configuration results in an error.org.apache.maven.plugin.MojoFailureException
- If the plugin application raises an error.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException