public class ClassWrangler extends Object
Modifier and Type | Field and Description |
---|---|
protected ClassLoader |
classLoader
ClassLoader to use for class wrangling.
|
protected String |
groovyVersion
Cached Groovy version.
|
protected Boolean |
isIndy
Cached whether Groovy supports invokedynamic (indy jar).
|
protected org.apache.maven.plugin.logging.Log |
log
Plugin log.
|
Constructor and Description |
---|
ClassWrangler(ClassLoader classLoaderForLoading,
org.apache.maven.plugin.logging.Log pluginLog)
Creates a new ClassWrangler using the specified ClassLoader.
|
ClassWrangler(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 |
---|---|
ClassLoader |
createNewClassLoader(List classpath)
Creates a new ClassLoader with the specified classpath.
|
Class |
getClass(String className)
Gets a class for the given class name.
|
ClassLoader |
getClassLoader()
Returns the classloader used for loading classes.
|
String |
getGroovyJar()
Returns the filename of the Groovy jar on the classpath.
|
Version |
getGroovyVersion()
Gets the version of Groovy used from the classpath.
|
String |
getGroovyVersionString()
Gets the version string of Groovy used from classpath.
|
protected 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(String goal)
Logs the version of groovy used by this mojo.
|
protected String groovyVersion
protected Boolean isIndy
protected ClassLoader classLoader
protected org.apache.maven.plugin.logging.Log log
public ClassWrangler(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(List classpath, org.apache.maven.plugin.logging.Log pluginLog) throws MalformedURLException
classpath
- the classpath to load the new ClassLoader withpluginLog
- the Maven log to use for loggingMalformedURLException
public 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 String getGroovyJar()
protected String getJarPath() throws ClassNotFoundException
ClassNotFoundException
- when Groovu couldn't be found on the classpathpublic void logGroovyVersion(String goal)
goal
- The goal to mention in the log statement showing Groovy versionpublic ClassLoader createNewClassLoader(List classpath) throws MalformedURLException
classpath
- the classpath (a list of file path Strings) to include in the new loaderMalformedURLException
- when a classpath element provides a malformed URLpublic Class getClass(String className) throws ClassNotFoundException
className
- the class name to retrieve the class forClassNotFoundException
- when a class for the specified class name cannot be foundpublic ClassLoader getClassLoader()
Copyright © 2011–2020. All rights reserved.