Class AbstractTentackleAnnotationProcessingMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.tentackle.maven.AbstractTentackleMojo
org.tentackle.maven.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 Details

    • showCompileOutput

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

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

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

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

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

      protected List<org.tentackle.buildsupport.AbstractTentackleProcessor> processors
      Annotation processors.
  • Constructor Details

    • AbstractTentackleAnnotationProcessingMojo

      public AbstractTentackleAnnotationProcessingMojo()
  • Method Details

    • setMojoParameters

      public void setMojoParameters(File sourceDir, List<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 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 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:
    • 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, 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(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(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 String[] filterFileNames(String dirName, 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