Package org.codehaus.mojo.javacc
Class JavaCCMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.codehaus.mojo.javacc.AbstractJavaCCMojo
-
- org.codehaus.mojo.javacc.JavaCCMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="javacc", defaultPhase=GENERATE_SOURCES) public class JavaCCMojo extends AbstractJavaCCMojoParses a JavaCC grammar file (*.jj) and transforms it to Java source files. Detailed information about the JavaCC options can be found on the JavaCC website.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]excludesA set of Ant-like exclusion patterns used to prevent certain files from being processed.private java.lang.String[]includesA set of Ant-like inclusion patterns used to select files from the source directory for processing.private java.io.FileoutputDirectoryThe directory where the parser files generated by JavaCC will be stored.private java.lang.StringpackageNameDeprecated.As of version 2.4 because the plugin extracts the package name from each grammar file.private java.io.FilesourceDirectoryThe directory where the JavaCC grammar files (*.jj) are located.private intstaleMillisThe granularity in milliseconds of the last modification date for testing whether a source needs recompilation.
-
Constructor Summary
Constructors Constructor Description JavaCCMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.io.File[]getCompileSourceRoots()Gets all the output directories to register with the project for compilation.protected java.lang.String[]getExcludes()Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.protected java.lang.String[]getIncludes()Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.protected java.io.FilegetOutputDirectory()Gets the absolute path to the directory where the generated Java files for the parser will be stored.protected java.lang.StringgetParserPackage()Gets the package into which the generated parser files should be stored.protected java.io.FilegetSourceDirectory()Gets the absolute path to the directory where the grammar files are located.protected intgetStaleMillis()Gets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.protected voidprocessGrammar(GrammarInfo grammarInfo)Passes the specified grammar file through the tool.-
Methods inherited from class org.codehaus.mojo.javacc.AbstractJavaCCMojo
copyGrammarOutput, deleteTempDirectory, execute, getGrammarEncoding, getIsStatic, getJdkVersion, getTempDirectory, isSourceRoot, newJavaCC
-
-
-
-
Field Detail
-
packageName
@Parameter(property="javacc.packageName") private java.lang.String packageName
Deprecated.As of version 2.4 because the plugin extracts the package name from each grammar file.Package into which the generated classes will be put. Note that this will also be used to create the directory structure where sources will be generated. Defaults to the package name specified in a grammar file.
-
sourceDirectory
@Parameter(property="javacc.sourceDirectory", defaultValue="${basedir}/src/main/javacc") private java.io.File sourceDirectoryThe directory where the JavaCC grammar files (*.jj) are located.
-
outputDirectory
@Parameter(property="javacc.outputDirectory", defaultValue="${project.build.directory}/generated-sources/javacc") private java.io.File outputDirectoryThe directory where the parser files generated by JavaCC will be stored. The directory will be registered as a compile source root of the project such that the generated files will participate in later build phases like compiling and packaging.
-
staleMillis
@Parameter(property="javacc.lastModGranularityMs", defaultValue="0") private int staleMillisThe granularity in milliseconds of the last modification date for testing whether a source needs recompilation.
-
includes
@Parameter private java.lang.String[] includes
A set of Ant-like inclusion patterns used to select files from the source directory for processing. By default, the patterns**/*.jjand**/*.JJare used to select grammar files.
-
excludes
@Parameter private java.lang.String[] excludes
A set of Ant-like exclusion patterns used to prevent certain files from being processed. By default, this set is empty such that no files are excluded.
-
-
Method Detail
-
getSourceDirectory
protected java.io.File getSourceDirectory()
Gets the absolute path to the directory where the grammar files are located.- Specified by:
getSourceDirectoryin classAbstractJavaCCMojo- Returns:
- The absolute path to the directory where the grammar files are located, never
null.
-
getIncludes
protected java.lang.String[] getIncludes()
Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.- Specified by:
getIncludesin classAbstractJavaCCMojo- 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 java.lang.String[] getExcludes()
Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.- Specified by:
getExcludesin classAbstractJavaCCMojo- 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 java.io.File getOutputDirectory()
Gets the absolute path to the directory where the generated Java files for the parser will be stored.- Specified by:
getOutputDirectoryin classAbstractJavaCCMojo- Returns:
- The absolute path to the directory where the generated Java files for the parser will be stored, never
null.
-
getStaleMillis
protected int getStaleMillis()
Gets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.- Specified by:
getStaleMillisin classAbstractJavaCCMojo- Returns:
- The granularity in milliseconds of the last modification date for testiintng whether a source needs recompilation.
-
getCompileSourceRoots
protected java.io.File[] getCompileSourceRoots()
Gets all the output directories to register with the project for compilation.- Specified by:
getCompileSourceRootsin classAbstractJavaCCMojo- Returns:
- The compile source roots to register with the project, never
null.
-
getParserPackage
protected java.lang.String getParserPackage()
Gets the package into which the generated parser files should be stored.- Overrides:
getParserPackagein classAbstractJavaCCMojo- Returns:
- The package into which the generated parser files should be stored, can be
nullto use the package declaration from the grammar file.
-
processGrammar
protected void processGrammar(GrammarInfo grammarInfo) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Passes the specified grammar file through the tool.- Specified by:
processGrammarin classAbstractJavaCCMojo- 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.
-
-