public class ClassWrangler
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.ClassLoader |
classLoader
ClassLoader to use for class wrangling.
|
protected java.lang.String |
groovyVersion
Cached Groovy version.
|
protected java.lang.Boolean |
isIndy
Cached whether Groovy supports invokedynamic (indy jar).
|
protected org.apache.maven.plugin.logging.Log |
log
Plugin log.
|
| Constructor and Description |
|---|
ClassWrangler(java.lang.ClassLoader classLoaderForLoading,
org.apache.maven.plugin.logging.Log pluginLog)
Creates a new ClassWrangler using the specified ClassLoader.
|
ClassWrangler(java.util.List classpath,
org.apache.maven.plugin.logging.Log pluginLog)
Creates a new ClassWrangler using a new ClassLoader, loaded with the
items from the specified classpath.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.ClassLoader |
createNewClassLoader(java.util.List classpath)
Creates a new ClassLoader with the specified classpath.
|
java.lang.Class |
getClass(java.lang.String className)
Gets a class for the given class name.
|
java.lang.ClassLoader |
getClassLoader()
Returns the classloader used for loading classes.
|
java.lang.String |
getGroovyJar()
Returns the filename of the Groovy jar on the classpath.
|
Version |
getGroovyVersion()
Gets the version of Groovy used from the classpath.
|
java.lang.String |
getGroovyVersionString()
Gets the version string of Groovy used from classpath.
|
protected java.lang.String |
getJarPath()
Returns the path of the Groovy jar on the classpath.
|
boolean |
isGroovyIndy()
Gets whether the version of Groovy on the classpath supports invokedynamic.
|
void |
logGroovyVersion(java.lang.String goal)
Logs the version of groovy used by this mojo.
|
protected java.lang.String groovyVersion
protected java.lang.Boolean isIndy
protected java.lang.ClassLoader classLoader
protected org.apache.maven.plugin.logging.Log log
public ClassWrangler(java.lang.ClassLoader classLoaderForLoading,
org.apache.maven.plugin.logging.Log pluginLog)
classLoaderForLoading - the ClassLoader to use to load classespluginLog - the Maven log to use for loggingpublic ClassWrangler(java.util.List classpath,
org.apache.maven.plugin.logging.Log pluginLog)
throws java.net.MalformedURLException
classpath - the classpath to load the new ClassLoader withpluginLog - the Maven log to use for loggingjava.net.MalformedURLExceptionpublic java.lang.String getGroovyVersionString()
public Version getGroovyVersion()
public boolean isGroovyIndy()
true if the version of Groovy uses invokedynamic,
false if not or Groovy dependency cannot be found.public java.lang.String getGroovyJar()
protected java.lang.String getJarPath()
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException - when Groovu couldn't be found on the classpathpublic void logGroovyVersion(java.lang.String goal)
goal - The goal to mention in the log statement showing Groovy versionpublic java.lang.ClassLoader createNewClassLoader(java.util.List classpath)
throws java.net.MalformedURLException
classpath - the classpath (a list of file path Strings) to include in the new loaderjava.net.MalformedURLException - when a classpath element provides a malformed URLpublic java.lang.Class getClass(java.lang.String className)
throws java.lang.ClassNotFoundException
className - the class name to retrieve the class forjava.lang.ClassNotFoundException - when a class for the specified class name cannot be foundpublic java.lang.ClassLoader getClassLoader()