Package org.codehaus.gmavenplus.mojo
Class AbstractGroovyMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.gmavenplus.mojo.AbstractGroovyMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractGroovySourcesMojo,AbstractToolsMojo
public abstract class AbstractGroovyMojo
extends org.apache.maven.plugin.AbstractMojo
The base mojo class, which all other mojos extend.
- Since:
- 1.0-beta-1
- Author:
- Keegan Witt
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClassWranglerThe wrangler to use to work with Groovy classes, classpaths, classLoaders, and versions.protected static final VersionGroovy 1.5.0 version.protected static final StringThe pattern defining Groovy files.protected static final VersionJava 1.7 version.protected static final VersionJava 1.8 version.protected static final VersionJava 1.8 version.protected static final StringThe pattern defining Java stub files.protected VersionThe minimum version of Groovy that this mojo supports (1.5.0 by default, but other mojos can override).protected org.apache.maven.plugin.MojoExecutionThe plugin's mojo execution.protected List<org.apache.maven.artifact.Artifact> The plugin dependencies.protected org.apache.maven.project.MavenProjectThe Maven project this plugin is being used on.protected org.apache.maven.execution.MavenSessionThe Maven Session this plugin is being used on.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected VersionGets the version of Java executing this mojo as a Version object.protected StringGets the version of Java executing this mojo as a String.protected booleangroovyAtLeast(Version version) Determines whether the detected Groovy version is the specified version or newer.protected booleanDetermines whether the detected Groovy version is the specified version.protected booleangroovyNewerThan(Version version) Determines whether the detected Groovy version is newer than the specified version.protected booleangroovyOlderThan(Version version) Determines whether the detected Groovy version is older than the specified version.protected booleanDetermines whether this mojo can be run with the version of Groovy supplied.protected booleanGets whether the version of Groovy on the classpath supports invokedynamic.protected booleanDetermines whether the version of Java executing this mojo supports invokedynamic (is at least 1.7).protected booleanDetermines whether the version of Java executing this mojo supports JEP 118 (is at least 1.8).protected booleanDetermines whether the version of Java executing this mojo supports preview features (is at least 12).protected voidLogs the plugin classpath.protected voidsetupClassWrangler(List<?> classpath, IncludeClasspath includeClasspath) Instantiate a ClassWrangler.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
GROOVY_SOURCES_PATTERN
The pattern defining Groovy files. -
JAVA_SOURCES_PATTERN
The pattern defining Java stub files. -
JAVA_1_7
Java 1.7 version. -
JAVA_1_8
Java 1.8 version. -
JAVA_12
Java 1.8 version. -
GROOVY_1_5_0
Groovy 1.5.0 version. -
classWrangler
The wrangler to use to work with Groovy classes, classpaths, classLoaders, and versions. -
project
@Parameter(property="project", required=true, readonly=true) protected org.apache.maven.project.MavenProject projectThe Maven project this plugin is being used on. -
session
@Parameter(property="session", required=true, readonly=true) protected org.apache.maven.execution.MavenSession sessionThe Maven Session this plugin is being used on. -
pluginArtifacts
@Parameter(property="plugin.artifacts", required=true, readonly=true) protected List<org.apache.maven.artifact.Artifact> pluginArtifactsThe plugin dependencies. -
mojoExecution
@Parameter(property="mojoExecution", required=true, readonly=true) protected org.apache.maven.plugin.MojoExecution mojoExecutionThe plugin's mojo execution. -
minGroovyVersion
The minimum version of Groovy that this mojo supports (1.5.0 by default, but other mojos can override).
-
-
Constructor Details
-
AbstractGroovyMojo
public AbstractGroovyMojo()
-
-
Method Details
-
logPluginClasspath
protected void logPluginClasspath()Logs the plugin classpath. -
isJavaSupportIndy
protected boolean isJavaSupportIndy()Determines whether the version of Java executing this mojo supports invokedynamic (is at least 1.7).- Returns:
trueif the running Java supports invokedynamic,falseotherwise
-
isJavaSupportPreviewFeatures
protected boolean isJavaSupportPreviewFeatures()Determines whether the version of Java executing this mojo supports preview features (is at least 12).- Returns:
trueif the running Java supports preview features,falseotherwise
-
isJavaSupportParameters
protected boolean isJavaSupportParameters()Determines whether the version of Java executing this mojo supports JEP 118 (is at least 1.8).- Returns:
trueif the running Java supports parameters,falseotherwise
-
getJavaVersion
Gets the version of Java executing this mojo as a Version object.- Returns:
- a Version object of the running Java version
-
getJavaVersionString
Gets the version of Java executing this mojo as a String.- Returns:
- a String of the running Java version
-
groovyVersionSupportsAction
protected boolean groovyVersionSupportsAction()Determines whether this mojo can be run with the version of Groovy supplied.- Returns:
trueonly if the version of Groovy supports this mojo
-
groovyAtLeast
Determines whether the detected Groovy version is the specified version or newer.- Parameters:
version- the version to compare the detected Groovy version to- Returns:
trueif the detected Groovy version is the specified version or newer,falseotherwise
-
groovyIs
Determines whether the detected Groovy version is the specified version.- Parameters:
version- the version to compare the detected Groovy version to- Returns:
trueif the detected Groovy version is the specified version,falseotherwise
-
groovyNewerThan
Determines whether the detected Groovy version is newer than the specified version.- Parameters:
version- the version to compare the detected Groovy version to- Returns:
trueif the detected Groovy version is newer than the specified version,falseotherwise
-
groovyOlderThan
Determines whether the detected Groovy version is older than the specified version.- Parameters:
version- the version to compare the detected Groovy version to- Returns:
trueif the detected Groovy version is older than the specified version,falseotherwise
-
isGroovyIndy
protected boolean isGroovyIndy()Gets whether the version of Groovy on the classpath supports invokedynamic.- Returns:
trueif the version of Groovy uses invokedynamic,falseif not or Groovy dependency cannot be found
-
setupClassWrangler
protected void setupClassWrangler(List<?> classpath, IncludeClasspath includeClasspath) throws MalformedURLException Instantiate a ClassWrangler.- Parameters:
classpath- the classpath to load onto a new classloader (if includeClasspath isPROJECT_ONLY)includeClasspath- whether to use a shared classloader that includes both the project classpath and plugin classpath.- Throws:
MalformedURLException- when a classpath element provides a malformed URL
-