Class AbstractGenerateStubsMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    GenerateStubsMojo, GenerateTestStubsMojo

    public abstract class AbstractGenerateStubsMojo
    extends AbstractGroovyStubSourcesMojo
    The base generate stubs mojo, which all generate stubs mojos extend.
    Since:
    1.0-beta-1
    Author:
    Keegan Witt
    • Field Detail

      • GROOVY_1_9_0_BETA1

        protected static final Version GROOVY_1_9_0_BETA1
        Groovy 2.9.0 beta-1 version.
      • GROOVY_1_9_0_BETA3

        protected static final Version GROOVY_1_9_0_BETA3
        Groovy 1.9.0 beta-3 version.
      • GROOVY_1_8_3

        protected static final Version GROOVY_1_8_3
        Groovy 1.8.3 version.
      • sourceEncoding

        protected String sourceEncoding
        The encoding of source files.
      • scriptExtensions

        protected Set<String> scriptExtensions
        The file extensions of Groovy source files.
        Since:
        1.0-beta-2
      • targetBytecode

        protected String targetBytecode
        The Groovy compiler bytecode compatibility. One of
        • 1.4
        • 1.5
        • 1.6
        • 1.7
        • 1.8
        Using 1.6 or 1.7 requires Groovy >= 2.1.3, and using 1.8 requires Groovy >= 2.3.3. If an invalid selection is made, Groovy will default to VM determined version (1.4 or 1.5).
        Since:
        1.0-beta-3
      • debug

        protected boolean debug
        Whether Groovy compiler should be set to debug.
      • verbose

        protected boolean verbose
        Whether Groovy compiler should be set to verbose.
      • warningLevel

        protected int warningLevel
        Groovy compiler warning level. Should be one of:
        0
        None
        1
        Likely Errors
        2
        Possible Errors
        3
        Paranoia
      • tolerance

        protected int tolerance
        Groovy compiler error tolerance (the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted).
    • Constructor Detail

      • AbstractGenerateStubsMojo

        public AbstractGenerateStubsMojo()
    • Method Detail

      • addGroovySources

        protected void addGroovySources​(Set<File> stubSources,
                                        Class compilerConfigurationClass,
                                        Class javaStubCompilationUnitClass,
                                        Object compilerConfiguration,
                                        Object javaStubCompilationUnit)
                                 throws InvocationTargetException,
                                        IllegalAccessException
        Adds the Groovy sources to the CompilationUnit.
        Parameters:
        stubSources - the sources to perform stub generation on
        compilerConfigurationClass - the CompilerConfiguration class
        javaStubCompilationUnitClass - the JavaStubCompilationUnit class
        compilerConfiguration - the CompilerConfiguration to use for stub generation
        javaStubCompilationUnit - the JavaStubCompilationUnit to use for stub generation
        Throws:
        IllegalAccessException - when a method needed for stub generation cannot be accessed
        InvocationTargetException - when a reflection invocation needed for stub generation cannot be completed
      • resetStubModifiedDates

        protected void resetStubModifiedDates​(Set<File> stubs)
        This is a fix for http://jira.codehaus.org/browse/MGROOVY-187 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