Class GWMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
This goal is exposed as gw:gw. It can run in a normal Maven project,
across a multi-module build, or without a pom.xml. When Maven parallel
execution is enabled, module traversal is coordinated by gw rather
than by the Maven reactor. Sub-modules are processed before their parent
modules, matching the reverse-order behavior of the Ghostwriter CLI and the
gw:act goal.
Parameters inherited from AbstractGWMojo
model- Provider/model identifier used by the workflow. Example:
mvn gw:gw -Dgw.model=openai:gpt-4o-mini. basedir- Maven module base directory, injected from
${basedir}by default. Example plugin configuration:<basedir>${project.basedir}</basedir>. path- Optional scan root override. Example:
mvn gw:gw -Dgw.path=src/main/java. instructions- Additional workflow instructions or instruction file locations. Example:
mvn gw:gw -Dgw.instructions=docs/gw-instructions.md. excludes- Path or glob-like patterns skipped during scanning. Example plugin
configuration:
<excludes><exclude>target/**</exclude></excludes>. project- The current Maven project, injected from
${project}when a project is present. session- The current Maven session, injected from
${session}and used to resolve reactor projects, execution root, and parallel execution settings. settings- Maven settings, injected from
${settings}, used for credentials resolution. serverId- Maven
settings.xmlserver id used to resolve GenAI credentials. Example:mvn gw:gw -Dgenai.serverId=my-ai-provider. reactorProjects- Read-only list of reactor projects injected from
${reactorProjects}for multi-module builds.
Usage examples
mvn gw:gw
mvn -T 4 gw:gw
mvn gw:gw -Dgw.path=src/test/java -Dgw.instructions=docs/guidance.md
mvn gw:gw -Dgenai.serverId=my-ai-provider
To include the literal closing Javadoc delimiter in generated documentation,
escape it as */.
- Since:
- 1.1.2
-
Field Summary
Fields inherited from class org.machanism.machai.gw.maven.AbstractGWMojo
basedir, classFunctionTools, excludes, instructions, logger, model, path, project, reactorProjects, sessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes thegw:gwgoal.private static org.apache.maven.project.MavenProjectresolveProjectByArtifactId(List<org.apache.maven.project.MavenProject> allProjects, org.apache.maven.model.Model effectiveModel) Resolves the Maven project from the current session that matches the artifact id of the supplied effective model.private static StringtoCoord(org.apache.maven.project.MavenProject project) Formats a Maven project as a coordinate string used in duplicate-artifact diagnostics.Methods inherited from class org.machanism.machai.gw.maven.AbstractGWMojo
getConfiguration, scanDocumentsMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
GWMojo
public GWMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionExecutes thegw:gwgoal.The method builds the effective processor configuration, creates a
GuidanceProcessor, resolves Maven module layout information when available, configures non-recursive and parallel execution behavior, and then delegates scanning toAbstractGWMojo.scanDocuments(GuidanceProcessor).- Throws:
org.apache.maven.plugin.MojoExecutionException- if configuration, scanning, or processing fails
-
resolveProjectByArtifactId
private static org.apache.maven.project.MavenProject resolveProjectByArtifactId(List<org.apache.maven.project.MavenProject> allProjects, org.apache.maven.model.Model effectiveModel) Resolves the Maven project from the current session that matches the artifact id of the supplied effective model.- Parameters:
allProjects- all Maven projects available in the sessioneffectiveModel- effective model discovered from a project layout- Returns:
- the matching Maven project, or
nullwhen no unique match is available - Throws:
IllegalStateException- if multiple session projects share the same artifact id
-
toCoord
Formats a Maven project as a coordinate string used in duplicate-artifact diagnostics.- Parameters:
project- project to format- Returns:
- coordinate in
groupId:artifactId:version@basedirform
-