public class ClassWrangler extends Object
| Constructor and Description |
|---|
ClassWrangler(List<?> classpath,
ClassLoader parentClassLoader,
org.apache.maven.plugin.logging.Log pluginLog)
Creates a new ClassWrangler using the specified parent ClassLoader, loaded with the items from the specified classpath.
|
| Modifier and Type | Method and Description |
|---|---|
protected ClassLoader |
createNewClassLoader(List<?> classpath,
ClassLoader classLoader)
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.
|
protected 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.
|
static boolean |
groovyAtLeast(Version detectedVersion,
Version compareToVersion)
Determines whether the detected Groovy version is the specified version or newer.
|
static boolean |
groovyIs(Version detectedVersion,
Version compareToVersion)
Determines whether the detected Groovy version is the specified version.
|
static boolean |
groovyNewerThan(Version detectedVersion,
Version compareToVersion)
Determines whether the detected Groovy version is newer than the specified version.
|
static boolean |
groovyOlderThan(Version detectedVersion,
Version compareToVersion)
Determines whether the detected Groovy version is older than the specified version.
|
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.
|
public ClassWrangler(List<?> classpath, ClassLoader parentClassLoader, org.apache.maven.plugin.logging.Log pluginLog) throws MalformedURLException
classpath - the classpath to load the new ClassLoader withparentClassLoader - the parent for the new ClassLoader used to use to load classespluginLog - the Maven log to use for loggingMalformedURLException - when a classpath element provides a malformed URLpublic String getGroovyVersionString()
public Version getGroovyVersion()
public static boolean groovyAtLeast(Version detectedVersion, Version compareToVersion)
detectedVersion - the detected Groovy versioncompareToVersion - the version to compare the detected Groovy version totrue if the detected Groovy version is the specified version or newer, false otherwisepublic static boolean groovyIs(Version detectedVersion, Version compareToVersion)
detectedVersion - the detected Groovy versioncompareToVersion - the version to compare the detected Groovy version totrue if the detected Groovy version is the specified version, false otherwisepublic static boolean groovyNewerThan(Version detectedVersion, Version compareToVersion)
detectedVersion - the detected Groovy versioncompareToVersion - the version to compare the detected Groovy version totrue if the detected Groovy version is newer than the specified version, false otherwisepublic static boolean groovyOlderThan(Version detectedVersion, Version compareToVersion)
detectedVersion - the detected Groovy versioncompareToVersion - the version to compare the detected Groovy version totrue if the detected Groovy version is older than the specified version, false otherwisepublic boolean isGroovyIndy()
true if the version of Groovy uses invokedynamic,
false if not or Groovy dependency cannot be found.public void logGroovyVersion(String goal)
goal - The goal to mention in the log statement showing Groovy versionpublic 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()
protected ClassLoader createNewClassLoader(List<?> classpath, ClassLoader classLoader) throws MalformedURLException
classpath - the classpath (a list of file path Strings) to include in the new loaderclassLoader - the ClassLoader to use as the parent for the new CLassLoaderMalformedURLException - when a classpath element provides a malformed URLprotected String getGroovyJar()
protected String getJarPath() throws ClassNotFoundException
ClassNotFoundException - when Groovy couldn't be found on the classpathCopyright © 2011–2025. All rights reserved.