Class AbstractTentackleAnnotationProcessingMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    public abstract class AbstractTentackleAnnotationProcessingMojo
    extends AbstractTentackleMojo
    Generates code and meta-information prior to wurbeling and compiling the sources.

    Picks up all annotations annotated with org.tentackle.common.Analyze.

    Author:
    harald
    • Field Detail

      • showCompileOutput

        @Parameter(defaultValue="${tentackle.showCompileOutput}")
        protected boolean showCompileOutput
        Show compile output.
      • encoding

        @Parameter(defaultValue="${project.build.sourceEncoding}")
        protected java.lang.String encoding
        Source file encode.
      • compilerArgs

        @Parameter
        protected java.util.List<java.lang.String> compilerArgs
        Arguments to be passed to the compiler.
        (see maven-compiler-plugin)
      • compilerArgument

        @Parameter
        protected java.lang.String compilerArgument
        Sets the unformatted single argument string to be passed to the compiler.
        (see maven-compiler-plugin)
      • filesets

        @Parameter
        protected java.util.List<org.apache.maven.shared.model.fileset.FileSet> filesets
        The list of file sets.
        If set the source directory is ignored.
      • processors

        protected java.util.List<org.tentackle.buildsupport.AbstractTentackleProcessor> processors
        Annotation processors.
    • Constructor Detail

      • AbstractTentackleAnnotationProcessingMojo

        public AbstractTentackleAnnotationProcessingMojo()
    • Method Detail

      • setMojoParameters

        public void setMojoParameters​(java.io.File sourceDir,
                                      java.util.List<java.lang.String> classpathElements)
                               throws org.apache.maven.plugin.MojoFailureException
        Sets the mojo parameters.
        Parameters:
        sourceDir - the directory holding the sources to be processed
        classpathElements - the mavenProject classpath
        Throws:
        org.apache.maven.plugin.MojoFailureException - if classloader could not be created
      • getProcessingClassloader

        public java.lang.ClassLoader getProcessingClassloader()
        Gets a classloader that searches also in the classpath elements of the project.
        Returns:
        the classloader
      • addProcessor

        public void addProcessor​(org.tentackle.buildsupport.AbstractTentackleProcessor processor)
        Adds an annotation processor.
        Parameters:
        processor - the annotation processor
      • createMissingDirs

        protected void createMissingDirs()
        Creates any missing directories.
      • getTotalCompileErrors

        public int getTotalCompileErrors()
        Gets the number of compile errors.
        Returns:
        0 if analyze phase completed, > 0 if analyze info may be incomplete due to errors
      • getCompileErrorLog

        public java.lang.String getCompileErrorLog()
        Gets the compiler error log.
        Returns:
        the log, empty if no errors
      • getTotalErrors

        public int getTotalErrors()
        Gets the number of analyze errors.
        Returns:
        the error count
      • executeImpl

        public void executeImpl()
                         throws org.apache.maven.plugin.MojoExecutionException,
                                org.apache.maven.plugin.MojoFailureException
        Description copied from class: AbstractTentackleMojo
        Implements the execution.
        TT-mojos must override this method instead of AbstractTentackleMojo.execute(). This method is only invoked if validation succeeds.
        Specified by:
        executeImpl in class AbstractTentackleMojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if an unexpected problem occurs
        org.apache.maven.plugin.MojoFailureException - if an expected problem (such as a compilation failure) occurs
        See Also:
        AbstractTentackleMojo.prepareExecute()
      • validate

        protected boolean validate()
                            throws org.apache.maven.plugin.MojoExecutionException
        Description copied from class: AbstractTentackleMojo
        Checks the configuration.
        Overrides:
        validate in class AbstractTentackleMojo
        Returns:
        true if continue with execution, false to skip
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if validation failed
      • initializeProcessor

        protected void initializeProcessor​(org.tentackle.buildsupport.AbstractTentackleProcessor processor,
                                           java.io.File srcDir)
                                    throws org.apache.maven.plugin.MojoFailureException
        Initializes a processor.
        Parameters:
        processor - the annotation processor
        srcDir - the source dir
        Throws:
        org.apache.maven.plugin.MojoFailureException - if initialization failed
      • initializeProcessors

        protected void initializeProcessors​(java.io.File srcDir)
                                     throws org.apache.maven.plugin.MojoFailureException
        Initializes all processors.
        Parameters:
        srcDir - the current file set directory
        Throws:
        org.apache.maven.plugin.MojoFailureException - if initialization failed
      • cleanupProcessors

        protected void cleanupProcessors​(java.io.File srcDir)
                                  throws org.apache.maven.plugin.MojoFailureException
        Cleans up the processors.
        Parameters:
        srcDir - the current file set directory
        Throws:
        org.apache.maven.plugin.MojoFailureException - if cleanup failed
      • filterFileNames

        protected java.lang.String[] filterFileNames​(java.lang.String dirName,
                                                     java.lang.String[] fileNames)
        Filters the files to be processed.
        If overridden, allows to skip the annotation processing.
        Parameters:
        dirName - the base directory
        fileNames - the file names relative to the directory
        Returns:
        the filtered file names