Package org.codehaus.mojo.javacc
Class AbstractPreprocessorMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.codehaus.mojo.javacc.AbstractPreprocessorMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
JJTreeMojo,JTBMojo
public abstract class AbstractPreprocessorMojo extends org.apache.maven.plugin.AbstractMojoProvides common services for all mojos that preprocess JavaCC grammar files.
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.project.MavenProjectprojectThe current Maven project.
-
Constructor Summary
Constructors Constructor Description AbstractPreprocessorMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddCompileSourceRoot()Registers the configured output directory as a compile source root for the current project.protected voidcreateTimestamp(GrammarInfo grammarInfo)Creates the timestamp file for the specified grammar file.voidexecute()Execute the tool.protected abstract java.lang.String[]getExcludes()Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.protected abstract java.lang.String[]getIncludes()Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.protected abstract java.io.FilegetOutputDirectory()Gets the absolute path to the directory where the generated Java files for the parser will be stored.protected abstract java.io.FilegetSourceDirectory()Gets the absolute path to the directory where the grammar files are located.protected abstract intgetStaleMillis()Gets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.protected abstract java.io.FilegetTimestampDirectory()Gets the absolute path to the directory where the processed input files will be stored for later detection of stale sources.protected abstract voidprocessGrammar(GrammarInfo grammarInfo)Passes the specified grammar file through the tool.private GrammarInfo[]scanForGrammars()Scans the configured source directory for grammar files which need processing.
-
-
-
Method Detail
-
getSourceDirectory
protected abstract java.io.File getSourceDirectory()
Gets the absolute path to the directory where the grammar files are located.- Returns:
- The absolute path to the directory where the grammar files are located, never
null.
-
getIncludes
protected abstract java.lang.String[] getIncludes()
Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.- Returns:
- A set of Ant-like inclusion patterns used to select files from the source directory for processing, can
be
nullif all files should be included.
-
getExcludes
protected abstract java.lang.String[] getExcludes()
Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.- Returns:
- A set of Ant-like inclusion patterns used to unselect files from the source directory for processing, can
be
nullif no files should be excluded.
-
getOutputDirectory
protected abstract java.io.File getOutputDirectory()
Gets the absolute path to the directory where the generated Java files for the parser will be stored.- Returns:
- The absolute path to the directory where the generated Java files for the parser will be stored, never
null.
-
getTimestampDirectory
protected abstract java.io.File getTimestampDirectory()
Gets the absolute path to the directory where the processed input files will be stored for later detection of stale sources.- Returns:
- The absolute path to the directory where the processed input files will be stored for later detection of
stale sources, never
null.
-
getStaleMillis
protected abstract int getStaleMillis()
Gets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.- Returns:
- The granularity in milliseconds of the last modification date for testing whether a source needs recompilation.
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionExecute the tool.- Throws:
org.apache.maven.plugin.MojoExecutionException- If the invocation of the tool failed.org.apache.maven.plugin.MojoFailureException- If the tool reported a non-zero exit code.
-
processGrammar
protected abstract void processGrammar(GrammarInfo grammarInfo) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Passes the specified grammar file through the tool.- Parameters:
grammarInfo- The grammar info describing the grammar file to process, must not benull.- Throws:
org.apache.maven.plugin.MojoExecutionException- If the invocation of the tool failed.org.apache.maven.plugin.MojoFailureException- If the tool reported a non-zero exit code.
-
scanForGrammars
private GrammarInfo[] scanForGrammars() throws org.apache.maven.plugin.MojoExecutionException
Scans the configured source directory for grammar files which need processing.- Returns:
- An array of grammar infos describing the found grammar files or
nullif the source directory does not exist. - Throws:
org.apache.maven.plugin.MojoExecutionException- If the source directory could not be scanned.
-
createTimestamp
protected void createTimestamp(GrammarInfo grammarInfo)
Creates the timestamp file for the specified grammar file.- Parameters:
grammarInfo- The grammar info describing the grammar file to process, must not benull.
-
addCompileSourceRoot
protected void addCompileSourceRoot()
Registers the configured output directory as a compile source root for the current project.
-
-