Class AbstractGWMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.machanism.machai.gw.maven.AbstractGWMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
ActMojo, GWMojo, GWPerModuleMojo

public abstract class AbstractGWMojo extends org.apache.maven.plugin.AbstractMojo
Base class for GWMojo Maven plugin goals.

This class centralizes shared configuration parameters and the common scan/execute flow. Concrete goals typically configure goal-specific behavior and delegate to scanDocuments(GuidanceProcessor).

It also resolves optional GenAI credentials from Maven settings.xml and exposes them to the processing pipeline through a PropertiesConfigurator.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected File
    The Maven module base directory.
    Tool set exposed to the processor for class-related project introspection.
    protected String[]
    Exclude patterns or paths skipped during scanning.
    protected String
    Instruction locations consumed by the workflow.
    (package private) static final org.slf4j.Logger
     
    protected boolean
    Whether to log the list of workflow input files.
    protected String
    Provider/model identifier to pass to the workflow.
    protected org.apache.maven.project.MavenProject
    The current Maven project.
    protected List<org.apache.maven.project.MavenProject>
    Reactor projects available in the current Maven session.
    (package private) String
    Optional scan root override.
    protected org.apache.maven.execution.MavenSession
    The current Maven session.

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates the base mojo instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Builds the processor configuration.
    protected void
    Configures and executes document scanning for the current project context.

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.maven.plugin.Mojo

    execute
  • Field Details

    • logger

      static final org.slf4j.Logger logger
    • model

      @Parameter(property="gw.model") protected String model
      Provider/model identifier to pass to the workflow.
    • basedir

      @Parameter(defaultValue="${basedir}", required=true) protected File basedir
      The Maven module base directory.
    • scanDir

      @Parameter(property="gw.scanDir") String scanDir
      Optional scan root override.
    • instructions

      @Parameter(property="instructions", name="instructions") protected String instructions
      Instruction locations consumed by the workflow.
    • excludes

      @Parameter(property="gw.excludes", name="excludes") protected String[] excludes
      Exclude patterns or paths skipped during scanning.
    • project

      @Parameter(readonly=true, defaultValue="${project}") protected org.apache.maven.project.MavenProject project
      The current Maven project.
    • session

      @Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession session
      The current Maven session.
    • logInputs

      @Parameter(property="logInputs", defaultValue="false") protected boolean logInputs
      Whether to log the list of workflow input files.
    • reactorProjects

      @Parameter(defaultValue="${reactorProjects}", readonly=true) protected List<org.apache.maven.project.MavenProject> reactorProjects
      Reactor projects available in the current Maven session.
    • classFunctionTools

      protected ClassFunctionalTools classFunctionTools
      Tool set exposed to the processor for class-related project introspection.
  • Constructor Details

    • AbstractGWMojo

      protected AbstractGWMojo()
      Creates the base mojo instance.
  • Method Details

    • getConfiguration

      protected PropertiesConfigurator getConfiguration() throws org.apache.maven.plugin.MojoExecutionException
      Builds the processor configuration.

      If a Maven server id is configured, this method reads the matching server entry from settings.xml and copies its username, password, and any custom XML configuration values into the returned configurator.

      Returns:
      configuration for downstream workflow execution
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if Maven settings are unavailable or the configured server cannot be found
    • scanDocuments

      protected void scanDocuments(GuidanceProcessor processor) throws org.apache.maven.plugin.MojoExecutionException
      Configures and executes document scanning for the current project context.

      This method applies configured excludes, optional instructions, input logging, and scan directory selection before invoking AIFileProcessor.scanDocuments(File, String). When a Maven project is present in the request, class-related helper tools are also registered with the processor.

      Parameters:
      processor - the processor to configure and execute
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if scanning or processing fails