public abstract class AbstractCompilerMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Field and Description |
---|---|
private java.lang.String[] |
annotationProcessors
Qualified class names of annotation processors to run.
|
private java.io.File |
basedir
The directory to run the compiler from if fork is true.
|
private java.io.File |
buildDirectory
The target directory of the compiler if fork is true.
|
private java.util.List<java.lang.String> |
compilerArgs
Arguments to be passed to the compiler.
|
private java.lang.String |
compilerArgument
Unformatted argument string to be passed to the compiler if fork is set to true.
|
private java.util.Map |
compilerArguments
Deprecated.
use
compilerArgs instead. |
private java.lang.String |
compilerId
The compiler id of the compiler to use.
|
private org.codehaus.plexus.compiler.manager.CompilerManager |
compilerManager
Plexus compiler manager.
|
private java.lang.String |
compilerVersion
Version of the compiler to use, ex.
|
private boolean |
debug
Whether to include debugging information in the compiled class files.
|
static java.lang.String |
DEFAULT_SOURCE_VERSION |
static java.lang.String |
DEFAULT_TARGET_VERSION |
private java.lang.String |
encoding
The -encoding argument for the Java compiler
|
private java.lang.String |
executable
The executable of the compiler to use when fork is true.
|
private boolean |
fork
Allows running the compiler in a separate process.
|
private java.io.File |
generatedSourcesDirectory
The directory where source files generated by annotation processors will be created.
|
private java.lang.String |
mavenCompilerEncoding
Deprecated.
use
encoding |
private java.lang.String |
maxmem
maximum size, in megabytes, of the memory allocation pool, ex.
|
private java.lang.String |
meminitial
Initial size, in megabytes, of the memory allocation pool, ex.
|
private boolean |
optimize
Optimize compiled code using the compiler's optimization methods
|
private java.lang.String |
outputFileName
Used to control the name of the output file when compiling a set of sources to a single file.
|
private java.lang.String |
proc
If only is specified, the annotation processors will run but no compilation will be
performed.
|
private boolean |
showDeprecation
Output source locations where deprecated APIs are used
|
private boolean |
showWarnings
Output warnings
|
protected java.lang.String |
source
The -source argument for the Java compiler
|
private int |
staleMillis
The granularity in milliseconds of the last modification date for testing whether a source
needs recompilation
|
protected java.lang.String |
target
The -target argument for the Java compiler
|
private boolean |
verbose
Whether to output messages about what the compiler is doing
|
Constructor and Description |
---|
AbstractCompilerMojo() |
Modifier and Type | Method and Description |
---|---|
private java.util.Set<java.io.File> |
computeStaleSources(org.codehaus.plexus.compiler.CompilerConfiguration compilerConfiguration,
org.codehaus.plexus.compiler.Compiler compiler,
org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner scanner) |
void |
execute() |
protected abstract java.util.List<java.lang.String> |
getClasspathElements() |
protected org.codehaus.plexus.compiler.CompilerConfiguration |
getCompilerConfiguration(java.util.List<java.lang.String> compileSourceRoots) |
protected abstract java.util.List |
getCompileSourceRoots() |
private java.lang.String |
getEncoding() |
private java.lang.String |
getMemoryValue(java.lang.String setting) |
protected abstract java.io.File |
getOutputDirectory() |
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner |
getSourceInclusionScanner(int staleMillis) |
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner |
getSourceInclusionScanner(java.lang.String inputFileEnding) |
private boolean |
isDigits(java.lang.String string) |
protected static java.util.List<java.lang.String> |
removeEmptyCompileSourceRoots(java.util.List compileSourceRootsList) |
public static final java.lang.String DEFAULT_SOURCE_VERSION
public static final java.lang.String DEFAULT_TARGET_VERSION
@Parameter(property="maven.compiler.debug", defaultValue="true") private boolean debug
@Parameter(property="maven.compiler.verbose", defaultValue="false") private boolean verbose
@Parameter(property="maven.compiler.showDeprecation", defaultValue="false") private boolean showDeprecation
@Parameter(property="maven.compiler.optimize", defaultValue="false") private boolean optimize
@Parameter(property="maven.compiler.showWarnings", defaultValue="false") private boolean showWarnings
@Parameter(property="maven.compiler.source") protected java.lang.String source
@Parameter(property="maven.compiler.target") protected java.lang.String target
@Parameter(property="maven.compiler.encoding", readonly=true) private java.lang.String mavenCompilerEncoding
encoding
@Parameter(property="project.build.sourceEncoding") private java.lang.String encoding
@Parameter(property="lastModGranularityMs", defaultValue="0") private int staleMillis
@Parameter(property="maven.compiler.compilerId", defaultValue="jdt") private java.lang.String compilerId
@Parameter(property="maven.compiler.compilerVersion") private java.lang.String compilerVersion
@Parameter(defaultValue="false") private boolean fork
@Parameter(property="maven.compiler.meminitial") private java.lang.String meminitial
@Parameter(property="maven.compiler.maxmem") private java.lang.String maxmem
@Parameter(property="maven.compiler.executable") private java.lang.String executable
@Parameter private java.lang.String proc
@Parameter private java.lang.String[] annotationProcessors
@Parameter(defaultValue="${project.build.directory}/generated-sources/annotations") private java.io.File generatedSourcesDirectory
@Parameter private java.util.Map compilerArguments
compilerArgs
instead.Arguments to be passed to the compiler (prepending a dash) if fork is set to true.
This is because the list of valid arguments passed to a Java compiler varies based on the compiler version.
@Parameter private java.util.List<java.lang.String> compilerArgs
@Parameter private java.lang.String compilerArgument
Unformatted argument string to be passed to the compiler if fork is set to true.
This is because the list of valid arguments passed to a Java compiler varies based on the compiler version.
@Parameter(property="project.build.finalName") private java.lang.String outputFileName
@Parameter(property="basedir", required=true, readonly=true) private java.io.File basedir
@Parameter(property="project.build.directory", readonly=true, required=true) private java.io.File buildDirectory
@Component private org.codehaus.plexus.compiler.manager.CompilerManager compilerManager
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(int staleMillis)
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(java.lang.String inputFileEnding)
protected abstract java.util.List<java.lang.String> getClasspathElements() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected abstract java.util.List getCompileSourceRoots() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected abstract java.io.File getOutputDirectory()
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
protected org.codehaus.plexus.compiler.CompilerConfiguration getCompilerConfiguration(java.util.List<java.lang.String> compileSourceRoots) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
private java.lang.String getEncoding()
private java.lang.String getMemoryValue(java.lang.String setting)
private boolean isDigits(java.lang.String string)
private java.util.Set<java.io.File> computeStaleSources(org.codehaus.plexus.compiler.CompilerConfiguration compilerConfiguration, org.codehaus.plexus.compiler.Compiler compiler, org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner scanner) throws org.apache.maven.plugin.MojoExecutionException, org.codehaus.plexus.compiler.CompilerException
org.apache.maven.plugin.MojoExecutionException
org.codehaus.plexus.compiler.CompilerException
protected static java.util.List<java.lang.String> removeEmptyCompileSourceRoots(java.util.List compileSourceRootsList)