Package org.codehaus.gmavenplus.mojo
Class AbstractGenerateStubsMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.gmavenplus.mojo.AbstractGroovyMojo
org.codehaus.gmavenplus.mojo.AbstractGroovySourcesMojo
org.codehaus.gmavenplus.mojo.AbstractGroovyStubSourcesMojo
org.codehaus.gmavenplus.mojo.AbstractGenerateStubsMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
GenerateStubsMojo,GenerateTestStubsMojo
The base generate stubs mojo, which all generate stubs mojos extend.
- Author:
- Keegan Witt
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether Groovy compiler should be set to debug.protected booleanWhether to execute in a forked process.protected static final VersionGroovy 1.8.2 version.protected IncludeClasspathWhat classpath to include.protected org.apache.maven.execution.MavenSessionThe Maven Session.protected booleanWhether to check that the version of Groovy used is able to use the requestedtargetBytecode.protected StringThe encoding of source files.protected StringThe Groovy compiler bytecode compatibility.protected intGroovy compiler error tolerance (the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted).protected org.apache.maven.toolchain.ToolchainManagerThe Maven ToolchainManager.protected booleanWhether Groovy compiler should be set to verbose.protected intGroovy compiler warning level.Fields inherited from class org.codehaus.gmavenplus.mojo.AbstractGroovySourcesMojo
MAIN, TESTFields inherited from class org.codehaus.gmavenplus.mojo.AbstractGroovyMojo
classWrangler, GROOVY_1_5_0, GROOVY_SOURCES_PATTERN, JAVA_1_7, JAVA_1_8, JAVA_12, JAVA_SOURCES_PATTERN, minGroovyVersion, mojoExecution, pluginArtifacts, pluginDescriptor, projectFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected voiddoStubGeneration(Set<File> stubSources, List<?> classpath, File outputDirectory) Performs the stub generation on the specified source files.protected voidlogGeneratedStubs(File outputDirectory) Logs the stubs that have been generated.protected voidperformForkedStubGeneration(GroovyStubConfiguration configuration, String javaExecutable) protected voidperformInProcessStubGeneration(GroovyStubConfiguration configuration, List<?> classpath) protected voidresetStubModifiedDates(Set<File> stubs) This is a fix for ... It modifies the dates of the created stubs to 1/1/1970, ensuring that the Java compiler will not overwrite perfectly good compiled Groovy just because it has a newer source stub.Methods inherited from class org.codehaus.gmavenplus.mojo.AbstractGroovyStubSourcesMojo
getStubs, removeSourceRootMethods inherited from class org.codehaus.gmavenplus.mojo.AbstractGroovySourcesMojo
getFiles, getFilesets, getTestFiles, getTestFilesetsMethods inherited from class org.codehaus.gmavenplus.mojo.AbstractGroovyMojo
getJavaExecutable, getJavaVersion, getJavaVersionString, groovyAtLeast, groovyIs, groovyNewerThan, groovyOlderThan, groovyVersionSupportsAction, isGroovyIndy, isJavaSupportIndy, isJavaSupportParameters, isJavaSupportPreviewFeatures, logPluginClasspath, setupClassWranglerMethods 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_1_8_2
Groovy 1.8.2 version. -
sourceEncoding
The encoding of source files. -
targetBytecode
The Groovy compiler bytecode compatibility. One of- 1.4 (or 4)
- 1.5 (or 5)
- 1.6 (or 6)
- 1.7 (or 7)
- 1.8 (or 8)
- 9 (or 1.9)
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- Since:
- 1.0-beta-3
-
skipBytecodeCheck
@Parameter(property="skipBytecodeCheck", defaultValue="false") protected boolean skipBytecodeCheckWhether to check that the version of Groovy used is able to use the requestedtargetBytecode.- Since:
- 1.9.0
-
debug
@Parameter(defaultValue="false") protected boolean debugWhether Groovy compiler should be set to debug. -
verbose
@Parameter(defaultValue="false") protected boolean verboseWhether Groovy compiler should be set to verbose. -
warningLevel
@Parameter(defaultValue="1") protected int warningLevelGroovy compiler warning level. Should be one of:- 0
- None
- 1
- Likely Errors
- 2
- Possible Errors
- 3
- Paranoia
-
tolerance
@Parameter(defaultValue="0") protected int toleranceGroovy compiler error tolerance (the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted). -
includeClasspath
What classpath to include. One of- PROJECT_ONLY
- PROJECT_AND_PLUGIN
- PLUGIN_ONLY
- Since:
- 1.8.0
-
toolchainManager
@Inject protected org.apache.maven.toolchain.ToolchainManager toolchainManagerThe Maven ToolchainManager. -
session
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession sessionThe Maven Session. -
fork
@Parameter(property="fork", defaultValue="false") protected boolean forkWhether to execute in a forked process.- Since:
- 4.3.0
-
-
Constructor Details
-
AbstractGenerateStubsMojo
public AbstractGenerateStubsMojo()
-
-
Method Details
-
doStubGeneration
protected void doStubGeneration(Set<File> stubSources, List<?> classpath, File outputDirectory) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, InstantiationException, MalformedURLException Performs the stub generation on the specified source files.- Parameters:
stubSources- the sources to perform stub generation onclasspath- The classpath to use for compilationoutputDirectory- the directory to write the stub files to- Throws:
ClassNotFoundException- when a class needed for stub generation cannot be foundInstantiationException- when a class needed for stub generation cannot be instantiatedIllegalAccessException- when a method needed for stub generation cannot be accessedInvocationTargetException- when a reflection invocation needed for stub generation cannot be completedMalformedURLException- when a classpath element provides a malformed URL
-
performInProcessStubGeneration
protected void performInProcessStubGeneration(GroovyStubConfiguration configuration, List<?> classpath) throws MalformedURLException, ClassNotFoundException, InvocationTargetException, InstantiationException, IllegalAccessException -
performForkedStubGeneration
protected void performForkedStubGeneration(GroovyStubConfiguration configuration, String javaExecutable) throws InvocationTargetException - Throws:
InvocationTargetException
-
buildForkClasspath
-
logGeneratedStubs
Logs the stubs that have been generated.- Parameters:
outputDirectory- the output directory for the stubs
-
resetStubModifiedDates
This is a fix for ... It modifies the dates of the created stubs to 1/1/1970, ensuring that the Java compiler will not overwrite perfectly good compiled Groovy just because it has a newer source stub. Basically, this prevents the stubs from causing a side effect with the Java compiler, but still allows stubs to work with JavaDoc.- Parameters:
stubs- the files on which to reset the modified date
-