Class AbstractJavaGeneratorMojo

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

    public abstract class AbstractJavaGeneratorMojo
    extends AbstractAdamsMojo

    Abstract superclass for Mojos generating Java source

    Based on jaxb2-maven-plugin code.
    Lennart Jörelid, FracPete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • environmentClass

        protected String environmentClass

        The ADAMS environment class to use.

      • packageName

        protected String packageName

        The package under which the source files will be generated.

    • Constructor Detail

      • AbstractJavaGeneratorMojo

        public AbstractJavaGeneratorMojo()
    • Method Detail

      • isReGenerationRequired

        protected boolean isReGenerationRequired()

        Java generation is required if any of the file products is outdated/stale.

        Specified by:
        isReGenerationRequired in class AbstractAdamsMojo
        true to indicate that this AbstractAdamsMojo should be run since its generated files were either stale or not present, and false otherwise.
      • generateCode

        protected abstract boolean generateCode()
                                         throws org.apache.maven.plugin.MojoExecutionException
        Generates the actual code.
        true if successfully generated
        org.apache.maven.plugin.MojoExecutionException - if code generation fails
      • performExecution

        protected boolean performExecution()
                                    throws org.apache.maven.plugin.MojoExecutionException,

        Implement this method to perform this Mojo's execution. This method will only be called if !shouldExecutionBeSkipped() && isReGenerationRequired().

        Specified by:
        performExecution in class AbstractAdamsMojo
        true if the timestamp of the stale file should be updated.
        org.apache.maven.plugin.MojoExecutionException - if an unexpected problem occurs. Throwing this exception causes a "BUILD ERROR" message to be displayed.
        org.apache.maven.plugin.MojoFailureException - if an expected problem (such as a compilation failure) occurs. Throwing this exception causes a "BUILD FAILURE" message to be displayed.
      • getSources

        protected abstract List<URL> getSources()
        Override this method to acquire a List holding all URLs to the sources for which this AbstractJavaGeneratorMojo should generate Java files. Sources are assumed to be in the form given by the sourceType value.
        A non-null List holding URLs to sources for the code generation.
      • addGeneratedSourcesToProjectSourceRoot

        protected abstract void addGeneratedSourcesToProjectSourceRoot()
        Adds any directories containing the generated classes to the appropriate Project compilation sources; either TestCompileSourceRoot or CompileSourceRoot depending on the exact Mojo implementation of this AbstractJavaGeneratorMojo.