public abstract class AbstractJavaCCMojo
extends org.apache.maven.plugin.AbstractMojo
Constructor and Description |
---|
AbstractJavaCCMojo() |
Modifier and Type | Method and Description |
---|---|
protected void |
copyGrammarOutput(File sourceRoot,
String packageName,
File tempDirectory,
String updatePattern)
Scans the filesystem for output files and copies them to the specified compile source root.
|
protected void |
deleteTempDirectory(File tempDirectory)
Deletes the specified temporary directory.
|
void |
execute()
Execute the tool.
|
protected abstract File[] |
getCompileSourceRoots()
Gets all the output directories to register with the project for compilation.
|
protected abstract String[] |
getExcludes()
Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.
|
protected String |
getGrammarEncoding()
Gets the file encoding of the grammar files.
|
protected abstract String[] |
getIncludes()
Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.
|
protected Boolean |
getIsStatic()
Gets the flag whether to generate static parser.
|
protected String |
getJdkVersion()
Gets the Java version for which to generate source code.
|
protected abstract File |
getOutputDirectory()
Gets the absolute path to the directory where the generated Java files for the parser will be stored.
|
protected String |
getParserPackage()
Gets the package into which the generated parser files should be stored.
|
protected abstract File |
getSourceDirectory()
Gets the absolute path to the directory where the grammar files are located.
|
protected abstract int |
getStaleMillis()
Gets the granularity in milliseconds of the last modification date for testing whether a source needs
recompilation.
|
protected File |
getTempDirectory()
Gets a temporary directory within the project's build directory.
|
protected boolean |
isSourceRoot(File directory)
Determines whether the specified directory denotes a compile source root of the current project.
|
protected org.codehaus.mojo.javacc.JavaCC |
newJavaCC()
Creates a new facade to invoke JavaCC.
|
protected abstract void |
processGrammar(org.codehaus.mojo.javacc.GrammarInfo grammarInfo)
Passes the specified grammar file through the tool.
|
protected String getGrammarEncoding()
null
if the user did not specify this mojo
parameter.protected String getJdkVersion()
null
if the user did not specify
this mojo parameter.protected Boolean getIsStatic()
null
if the user did not specify this
mojo parameter.protected abstract File getSourceDirectory()
null
.protected abstract String[] getIncludes()
null
if all files should be included.protected abstract String[] getExcludes()
null
if no files should be excluded.protected abstract File getOutputDirectory()
null
.protected abstract int getStaleMillis()
protected abstract File[] getCompileSourceRoots()
null
.protected String getParserPackage()
null
to use the
package declaration from the grammar file.public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
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.protected abstract void processGrammar(org.codehaus.mojo.javacc.GrammarInfo grammarInfo) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
grammarInfo
- The grammar info describing the grammar file to process, must not be null
.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.protected File getTempDirectory()
null
.protected void deleteTempDirectory(File tempDirectory)
tempDirectory
- The directory to delete, must not be null
.protected void copyGrammarOutput(File sourceRoot, String packageName, File tempDirectory, String updatePattern) throws org.apache.maven.plugin.MojoExecutionException
src/main/java
or similar.packageName
- The name of the destination package for the output files, must not be null
.sourceRoot
- The (absolute) path to the compile source root into which the output files should eventually be
copied, must not be null
.tempDirectory
- The (absolute) path to the directory to scan for generated output files, must not be
null
.updatePattern
- A glob pattern that matches the (simple) names of those files which should always be updated
in case we are outputting directly into src/main/java
, may be null
. A
leading "!" may be used to negate the pattern.org.apache.maven.plugin.MojoExecutionException
- If the output files could not be copied.protected boolean isSourceRoot(File directory)
directory
- The directory to check, must not be null
.true
if the specified directory is a compile source root of the project, false
otherwise.protected org.codehaus.mojo.javacc.JavaCC newJavaCC()
null
.Copyright © 2005-2015 Codehaus. All Rights Reserved.