@Mojo(name="preprocess",
defaultPhase=GENERATE_SOURCES,
threadSafe=true,
requiresProject=true)
public class PreprocessorMojo
extends org.apache.maven.plugin.AbstractMojo
implements PreprocessorLogger
| Modifier and Type | Field and Description |
|---|---|
private boolean |
allowWhitespace
Manage mode to allow whitespace between the // and the #.
|
private boolean |
careForLastNextLine
Be precise in processing of the last next line char in files, it will not be added if it is not presented if to turn on the mode..
|
private java.io.File[] |
cfgFiles
List of external configuration files.
|
private boolean |
clear
Clear the destination folder before preprocessing (if it exists).
|
private boolean |
compareDestination
Flag to compare generated content with existing file and if it is the same then to not override the file, it brings overhead
|
private java.util.List<java.lang.String> |
compileSourceRoots
The Project source roots for non-test mode.
|
private boolean |
copyFileAttributes
Copy file attributes for copied and generated files.
|
private java.io.File |
destination
The Destination folder where generated sources will be placed in non-test mode.
|
private boolean |
disableOut
Make dry run of the preprocessor without any saving of result.
|
private java.lang.String |
excluded
List of file extensions to be excluded from the preprocessing process.
|
private java.lang.String[] |
excludedFolders
List of sub-folders in source folders to be excluded from preprocessing, ANT path pattern format allowed.
|
private java.util.Properties |
globalVars
List of global preprocessing variables.
|
private boolean |
ignoreMissingSources
Flag to ignore missing source folders, if false then mojo fail for any missing source folder, if true then missing folder will be ignored.
|
private java.lang.String |
inEncoding
The Input text encoding to be used for preprocessing, by default it uses defined in project properties.
|
private boolean |
keepLines
Disable removing lines from preprocessed files, it allows to keep line numeration similar to original sources.
|
private boolean |
keepSrcRoot
Disable overriding of the source root folders for maven project after preprocessing.
|
private java.lang.String |
outEncoding
The Encoding for preprocessed text output, by default it uses defined in project properties.
|
private boolean |
preserveIndent
Preserve indents in lines marked by '//$' and '//$$' directives.
|
private java.lang.String |
processing
List of file extensions to be preprocessed.
|
private org.apache.maven.project.MavenProject |
project
The Maven Project to be preprocessed.
|
private boolean |
removeComments
Remove all Java like commentaries from preprocessed sources.
|
private boolean |
skip
Skip preprocessing.
|
private java.lang.String |
source
The Directly defined source directory, it will make plugin to preprocess the folder instead of project and maven defined ones.
|
private java.util.List<java.lang.String> |
testCompileSourceRoots
The Project source roots for test mode.
|
private java.io.File |
testDestination
Destination folder where generated sources will be placed in test-mode.
|
private boolean |
unknownVarAsFalse
Flag to interpret unknown variable as FALSE.
|
private boolean |
useTestSources
Allow usage of the preprocessor for test sources (since 5.3.4 version).
|
private boolean |
verbose
Turn on the verbose mode for preprocessing process.
|
| Constructor and Description |
|---|
PreprocessorMojo() |
| Modifier and Type | Method and Description |
|---|---|
void |
debug(java.lang.String message)
Log a debug message
|
void |
error(java.lang.String message)
Log an error message
|
void |
execute() |
boolean |
getAllowWhitespace() |
boolean |
getCarForLastNextLine() |
java.io.File[] |
getCfgFiles() |
boolean |
getClear() |
boolean |
getCopyFileAttributes() |
java.io.File |
getDestination() |
boolean |
getDisableOut() |
java.lang.String |
getExcluded() |
java.lang.String[] |
getExcludedFolders() |
java.util.Properties |
getGlobalVars() |
java.lang.String |
getInEncoding() |
boolean |
getKeepLines() |
boolean |
getKeepSrcRoot() |
java.lang.String |
getOutEncoding() |
boolean |
getPreserveIndent() |
java.lang.String |
getProcessing() |
boolean |
getRemoveComments() |
java.lang.String |
getSource() |
java.io.File |
getTestDestination() |
boolean |
getUnknownVarAsFalse() |
boolean |
getUseTestSources() |
boolean |
getVerbose() |
void |
info(java.lang.String message)
Log an information message
|
boolean |
isCompareDestination() |
boolean |
isIgnoreMissingSources() |
boolean |
isSkip() |
(package private) PreprocessorContext |
makePreprocessorContext(java.lang.String sourceFoldersInPreprocessorFormat) |
private java.lang.String |
makeSourceRootList() |
private void |
replaceSourceRootByPreprocessingDestinationFolder(PreprocessorContext context) |
void |
setAllowWhitespace(boolean flag) |
void |
setCareForLastNextLine(boolean flag) |
void |
setCfgFiles(java.io.File[] files) |
void |
setClear(boolean flag) |
void |
setCompareDestination(boolean flag) |
void |
setCopyFileAttributes(boolean flag) |
void |
setDestination(java.io.File destination) |
void |
setDisableOut(boolean value) |
void |
setExcluded(java.lang.String excluded) |
void |
setExcludedFolders(java.lang.String... antPatterns) |
void |
setGlobalVars(java.util.Properties vars) |
void |
setIgnoreMissingSources(boolean flag) |
void |
setInEncoding(java.lang.String value) |
void |
setKeepLines(boolean keepLines) |
void |
setKeepSrcRoot(boolean flag) |
void |
setOutEncoding(java.lang.String value) |
void |
setPreserveIndent(boolean flag) |
void |
setProcessing(java.lang.String processing) |
void |
setRemoveComments(boolean value) |
void |
setSkip(boolean flag) |
void |
setSource(java.lang.String source) |
void |
setTestDestination(java.io.File destination) |
void |
setUnknownVarAsFalse(boolean flag) |
void |
setUseTestSources(boolean flag) |
void |
setVerbose(boolean verbose) |
void |
warning(java.lang.String message)
Log a warning message
|
@Parameter(alias="compileSourceRoots",
defaultValue="${project.compileSourceRoots}",
required=true,
readonly=true)
private java.util.List<java.lang.String> compileSourceRoots
@Parameter(alias="testCompileSourceRoots",
defaultValue="${project.testCompileSourceRoots}",
required=true,
readonly=true)
private java.util.List<java.lang.String> testCompileSourceRoots
@Parameter(defaultValue="${project}",
required=true,
readonly=true)
private org.apache.maven.project.MavenProject project
@Parameter(alias="source",
defaultValue="")
private java.lang.String source
@Parameter(alias="copyFileAttributes",
defaultValue="false")
private boolean copyFileAttributes
@Parameter(alias="destination",
defaultValue="${project.build.directory}/generated-sources/preprocessed")
private java.io.File destination
@Parameter(alias="testDestination",
defaultValue="${project.build.directory}/generated-test-sources/preprocessed")
private java.io.File testDestination
@Parameter(alias="inEncoding",
defaultValue="${project.build.sourceEncoding}")
private java.lang.String inEncoding
@Parameter(alias="outEncoding",
defaultValue="${project.build.sourceEncoding}")
private java.lang.String outEncoding
@Parameter(alias="ignoreMissingSources",
defaultValue="false")
private boolean ignoreMissingSources
@Parameter(alias="excluded") private java.lang.String excluded
@Parameter(alias="processing") private java.lang.String processing
@Parameter(alias="unknownVarAsFalse",
defaultValue="false")
private boolean unknownVarAsFalse
@Parameter(alias="disableOut",
defaultValue="false")
private boolean disableOut
@Parameter(alias="verbose",
defaultValue="false")
private boolean verbose
@Parameter(alias="clear",
defaultValue="false")
private boolean clear
@Parameter(alias="careForLastNextLine",
defaultValue="false")
private boolean careForLastNextLine
@Parameter(alias="keepSrcRoot",
defaultValue="false")
private boolean keepSrcRoot
@Parameter(alias="removeComments",
defaultValue="false")
private boolean removeComments
@Parameter(alias="globalVars") private java.util.Properties globalVars
@Parameter(alias="excludedFolders") private java.lang.String[] excludedFolders
@Parameter(alias="cfgFiles") private java.io.File[] cfgFiles
@Parameter(alias="keepLines",
defaultValue="true")
private boolean keepLines
@Parameter(alias="allowWhitespace",
defaultValue="false")
private boolean allowWhitespace
@Parameter(alias="preserveIndent",
defaultValue="false")
private boolean preserveIndent
@Parameter(alias="useTestSources",
defaultValue="false")
private boolean useTestSources
@Parameter(alias="skip",
property="jcp.preprocess.skip",
defaultValue="false")
private boolean skip
@Parameter(alias="compareDestination",
defaultValue="false")
private boolean compareDestination
public void setExcludedFolders(@MustNotContainNull java.lang.String... antPatterns)
@MustNotContainNull public java.lang.String[] getExcludedFolders()
public void setIgnoreMissingSources(boolean flag)
public boolean isIgnoreMissingSources()
public void setSkip(boolean flag)
public boolean isSkip()
public void setPreserveIndent(boolean flag)
public boolean getPreserveIndent()
public void setCopyFileAttributes(boolean flag)
public boolean getCopyFileAttributes()
public void setUseTestSources(boolean flag)
public boolean getUseTestSources()
public void setClear(boolean flag)
public boolean getClear()
public void setCareForLastNextLine(boolean flag)
public boolean getCarForLastNextLine()
public void setKeepSrcRoot(boolean flag)
public boolean getKeepSrcRoot()
public void setGlobalVars(java.util.Properties vars)
public java.util.Properties getGlobalVars()
public void setCfgFiles(@MustNotContainNull java.io.File[] files)
@MustNotContainNull public java.io.File[] getCfgFiles()
public void setCompareDestination(boolean flag)
public boolean isCompareDestination()
public void setSource(java.lang.String source)
public java.lang.String getSource()
public void setDestination(java.io.File destination)
public java.io.File getDestination()
public void setTestDestination(java.io.File destination)
public java.io.File getTestDestination()
public void setInEncoding(java.lang.String value)
public java.lang.String getInEncoding()
public void setOutEncoding(java.lang.String value)
public java.lang.String getOutEncoding()
public void setExcluded(java.lang.String excluded)
public java.lang.String getExcluded()
public void setUnknownVarAsFalse(boolean flag)
public boolean getUnknownVarAsFalse()
public void setProcessing(java.lang.String processing)
public java.lang.String getProcessing()
public void setDisableOut(boolean value)
public boolean getDisableOut()
public void setVerbose(boolean verbose)
public boolean getVerbose()
public void setKeepLines(boolean keepLines)
public boolean getKeepLines()
public void setAllowWhitespace(boolean flag)
public boolean getAllowWhitespace()
public void setRemoveComments(boolean value)
public boolean getRemoveComments()
private java.lang.String makeSourceRootList()
private void replaceSourceRootByPreprocessingDestinationFolder(PreprocessorContext context) throws java.io.IOException
java.io.IOExceptionPreprocessorContext makePreprocessorContext(java.lang.String sourceFoldersInPreprocessorFormat) throws java.io.IOException
java.io.IOExceptionpublic void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
execute in interface org.apache.maven.plugin.Mojoorg.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionpublic void error(java.lang.String message)
PreprocessorLoggererror in interface PreprocessorLoggermessage - the text to be output into the error logpublic void info(java.lang.String message)
PreprocessorLoggerinfo in interface PreprocessorLoggermessage - the text to be output into the information logpublic void warning(java.lang.String message)
PreprocessorLoggerwarning in interface PreprocessorLoggermessage - the text to be output into the warning logpublic void debug(java.lang.String message)
PreprocessorLoggerdebug in interface PreprocessorLoggermessage - the text to be output into the information log