Package org.machanism.machai.gw.maven
Class ActMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.machanism.machai.gw.maven.AbstractGWMojo
org.machanism.machai.gw.maven.ActMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
ActPerModuleMojo
@Mojo(name="act",
aggregator=true,
threadSafe=true,
requiresProject=false,
requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
public class ActMojo
extends AbstractGWMojo
Maven goal Inherited parameters (from
gw:act that runs an interactive, predefined "action" over
a documentation tree.
An action is a prompt (typically sourced from a resource bundle or prompt
file) that is applied to scanned documents. If -Dgw.act is not
provided, the goal prompts the user interactively via Maven's
Prompter component.
Parameters
-Dgw.act/<act>- Action text/prompt to apply. If omitted, the goal reads it interactively.
-Dgw.acts/<acts>- Optional directory containing predefined action definitions.
Inherited parameters (from AbstractGWMojo)
This goal also supports all common parameters defined by
AbstractGWMojo (for example -Dgw.model, -Dgw.scanDir,
-Dgw.excludes, -Dgenai.serverId, and -DlogInputs).
Usage examples
mvn gw:act
mvn gw:act -Dgw.act="Rewrite headings for clarity" -Dgw.scanDir=src\\site
mvn gw:act -Dgw.acts=src\\site\\acts -DlogInputs=true
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringAction prompt text.protected org.codehaus.plexus.components.interactivity.PrompterInteractive prompt provider used to collect action input.Fields inherited from class org.machanism.machai.gw.maven.AbstractGWMojo
basedir, classFunctionTools, excludes, instructions, logger, logInputs, model, project, reactorProjects, scanDir, sessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyActPrompt(Configurator conf) voidconfigureAndScan(ActProcessor actProcessor) voidexecute()Executes the interactive action and scans documents using the configured action prompt.protected voidprocess(ActProcessor actProcessor) Reads multi-line input from the interactivePrompter.protected voidscanDocuments(ActProcessor actProcessor) Methods inherited from class org.machanism.machai.gw.maven.AbstractGWMojo
getConfiguration, scanDocumentsMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
prompter
@Component protected org.codehaus.plexus.components.interactivity.Prompter prompterInteractive prompt provider used to collect action input. -
actPrompt
Action prompt text. If not set, the goal prompts the user interactively.
-
-
Constructor Details
-
ActMojo
public ActMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionExecutes the interactive action and scans documents using the configured action prompt.- Throws:
org.apache.maven.plugin.MojoExecutionException- if an I/O failure occurs while processing files
-
process
protected void process(ActProcessor actProcessor) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
configureAndScan
public void configureAndScan(ActProcessor actProcessor) throws org.apache.maven.plugin.MojoExecutionException, IOException - Throws:
org.apache.maven.plugin.MojoExecutionExceptionIOException
-
applyActPrompt
protected void applyActPrompt(Configurator conf) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
scanDocuments
- Throws:
IOException
-
readText
public String readText(String prompt) throws org.codehaus.plexus.components.interactivity.PrompterException Reads multi-line input from the interactivePrompter.The user can enter multiple lines by ending a line with
Ghostwriter.MULTIPLE_LINES_BREAKER. Input collection stops when a line does not end with the breaker.- Parameters:
prompt- the initial prompt label displayed to the user- Returns:
- the collected text
- Throws:
org.codehaus.plexus.components.interactivity.PrompterException- if prompting fails
-