Class AbstractGWMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
ActMojo,GWMojo,GWPerModuleMojo
GuidanceProcessor.
The mojo resolves Maven project/session context, optional scanner inputs, and GenAI provider credentials from Maven settings before executing the scan. It is intended to be extended by concrete plugin goals that create and configure the processor instance.
Parameters
model: Provider or model identifier supplied with-Dfollowed byGWConstants.MODEL_PROP_NAME; for example,mvn machai:goal -Dfollowed byGWConstants.MODEL_PROP_NAMEfollowed by=openai:gpt-4o-mini.basedir: Maven module base directory. The default value is the Maven expression${basedir}; for example, Maven injects the current module directory automatically during normal plugin execution.path: Optional file, directory, glob, or pattern to scan, supplied with-Dfollowed byGWConstants.PATH_PROP_NAME; for example,mvn machai:goal -Dfollowed byGWConstants.PATH_PROP_NAMEfollowed by=src/main/java.instructions: Additional workflow instructions, supplied with-Dfollowed byGWConstants.INSTRUCTIONS_PROP_NAME; for example,mvn machai:goal -Dfollowed byGWConstants.INSTRUCTIONS_PROP_NAMEfollowed by="Keep public APIs backward compatible".excludes: Paths or patterns excluded from scanning, supplied with-Dfollowed byGWConstants.EXCLUDES_PROP_NAME; for example,mvn machai:goal -Dfollowed byGWConstants.EXCLUDES_PROP_NAMEfollowed by=target,build.project: Current Maven project injected from the Maven expression${project}; for example, this is used automatically to locate the project base directory.session: Current Maven session injected from the Maven expression${session}; for example, this is used automatically to resolve the execution root directory.settings: Maven settings injected from the Maven expression${settings}; for example, this is used automatically to look up server credentials fromsettings.xml.serverId: Maven server id for GenAI credentials, supplied with-Dfollowed byAbstractAIProvider.SERVERID_PROP_NAME; for example,mvn machai:goal -Dfollowed byAbstractAIProvider.SERVERID_PROP_NAMEfollowed by=machai-ai. The corresponding<server>entry may define username, password, and custom configuration values.reactorProjects: Reactor projects injected from the Maven expression${reactorProjects}; for example, this is used automatically during multi-module builds.
When documenting XML snippets in this Javadoc, write any literal closing
Javadoc delimiter as */ rather than the raw delimiter.
- Since:
- 1.1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FileThe Maven module base directory.protected ClassFunctionalToolsTool set exposed to the processor for class-related project introspection.protected String[]Exclude patterns or path skipped during scanning.protected StringInstruction locations consumed by the workflow.(package private) static final org.slf4j.Loggerprotected StringProvider/model identifier to pass to the workflow.(package private) StringOptional scan root override.protected org.apache.maven.project.MavenProjectThe current Maven project.protected List<org.apache.maven.project.MavenProject> Reactor projects available in the current Maven session.private StringMavenserverid used to resolve GenAI credentials.protected org.apache.maven.execution.MavenSessionThe current Maven session.private org.apache.maven.settings.SettingsMaven settings used to resolve credentials fromsettings.xml.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PropertiesConfiguratorBuilds the processor configuration.protected voidscanDocuments(GuidanceProcessor processor) Configures and executes document scanning for the current project context.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
logger
static final org.slf4j.Logger logger -
model
Provider/model identifier to pass to the workflow. -
basedir
The Maven module base directory. -
path
Optional scan root override. -
instructions
Instruction locations consumed by the workflow. -
excludes
Exclude patterns or path skipped during scanning. -
project
@Parameter(readonly=true, defaultValue="${project}") protected org.apache.maven.project.MavenProject projectThe current Maven project. -
session
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession sessionThe current Maven session. -
settings
@Parameter(readonly=true, defaultValue="${settings}") private org.apache.maven.settings.Settings settingsMaven settings used to resolve credentials fromsettings.xml. -
serverId
Mavenserverid used to resolve GenAI credentials. -
reactorProjects
@Parameter(defaultValue="${reactorProjects}", readonly=true) protected List<org.apache.maven.project.MavenProject> reactorProjectsReactor projects available in the current Maven session. -
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.MojoExecutionExceptionBuilds the processor configuration.If a Maven server id is configured, this method reads the matching server entry from
settings.xmland 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
-