Class GWPerModuleMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
Unlike an aggregator goal, this mojo runs once per module in the active Maven reactor. Maven determines module execution order using the standard reactor dependency graph, so submodules are processed according to their dependencies.
The processor's processModule hook is intentionally disabled for this
goal. Maven's reactor, rather than recursive processor calls, invokes the goal
for every selected module in dependency order.
The goal reuses the shared scanning and GenAI configuration implemented by
AbstractGWMojo. It initializes a GuidanceProcessor rooted at
the reactor execution directory while binding Maven-specific project layout
metadata for each processed module.
Parameters
This goal does not declare additional parameters. It uses every configurable
parameter declared by its superclass, AbstractGWMojo; Maven injects
those inherited fields into this goal in exactly the same way as fields
declared directly on a mojo. The inherited implementation also uses
AbstractGWMojo.getConfiguration() to load provider settings and
AbstractGWMojo.scanDocuments(GuidanceProcessor) to apply the scan
configuration.
Inherited parameters
gw.model(model) - Provider/model identifier passed to the workflow. For example,mvn gw:gw-per-module -Dgw.model=openai:gpt-4o-miniselects a model.${basedir}(basedir) - Maven module base directory used as the default module location. Maven supplies this value automatically; it can be configured explicitly with<basedir>/path/to/module</basedir>.gw.path(path) - Optional scan root override. If not provided, the goal scans the current module base directory. For example,mvn gw:gw-per-module -Dgw.path=src/sitescans that directory.gw.instructions/<instructions>(instructions) - Instruction locations consumed by the workflow. For example,mvn gw:gw-per-module -Dgw.instructions=src/site/guidance.mdsupplies an instruction file.gw.excludes/<excludes>(excludes) - Exclude patterns or paths skipped during scanning. For example,mvn gw:gw-per-module -Dgw.excludes=target,buildexcludes both paths.${project}(project) - The current Maven project injected by Maven and used to obtain the module base directory. It is normally supplied automatically; a typical invocation that supplies this context ismvn gw:gw-per-modulefrom a Maven module.${session}(session) - The current Maven session, supplied automatically and used to determine the reactor execution root. For example,mvn gw:gw-per-module -pl module-a -amsupplies the session containing the selected reactor projects.${settings}(settings) - Maven settings used to resolve credentials fromsettings.xml; Maven supplies this value. For example,mvn gw:gw-per-module -Dgenai.serverId=ai-serveruses the settings object to resolve theai-serverentry.genai.serverId(serverId) - Mavenserverid used to resolve GenAI credentials. For example,mvn gw:gw-per-module -Dgenai.serverId=my-model-serverselects that server entry.params(params) - Additional key-value properties merged into the workflow configuration. For example,<params><endpoint>https://api.example.test</endpoint></params>adds anendpointproperty.gw.config(configFile) - Optional configuration file used whengenai.serverIdis not set. For example,mvn gw:gw-per-module -Dgw.config=machai.propertiesloads that file.
Usage examples
Process each module in the current reactor build
mvn gw:gw-per-module
Restrict scanning to a module documentation directory
mvn gw:gw-per-module -Dgw.path=src/site
Use instructions and excludes while processing reactor modules
mvn gw:gw-per-module \ -Dgw.instructions=src/site/guidance.md \ -Dgw.excludes=target,node_modules
Resolve GenAI credentials from Maven settings
mvn gw:gw-per-module -Dgenai.serverId=my-model-server
Plugin configuration
<plugin>
<groupId>org.machanism</groupId>
<artifactId>gw-maven-plugin</artifactId>
<version>...</version>
<configuration>
<model>openai:gpt-4.1</model>
<path>${project.basedir}/src/site</path>
<instructions>src/site/guidance.md</instructions>
</configuration>
</plugin>
-
Field Summary
Fields inherited from class org.machanism.machai.gw.maven.AbstractGWMojo
basedir, classFunctionTools, configFile, excludes, instructions, logger, model, params, path, project, serverId, SERVERID_PROP_NAME, session, settingsFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the guidance processor for this reactor module.Methods inherited from class org.machanism.machai.gw.maven.AbstractGWMojo
getConfiguration, scanDocuments, setBasedir, setConfigFile, setExcludes, setInstructions, setModel, setParams, setPath, setProject, setServerId, setSession, setSettingsMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
GWPerModuleMojo
public GWPerModuleMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionExecutes the guidance processor for this reactor module.The method initializes usage tracking, resolves workflow configuration, and scans this module's base directory unless
pathoverrides it. When a Maven project is present, it also registers class-inspection tools before scanning.- Throws:
org.apache.maven.plugin.MojoExecutionException- if configuration cannot be resolved or document processing is terminated or fails
-