Package copied.org.apache.maven.plugin
Class AbstractCompilerMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- copied.org.apache.maven.plugin.AbstractCompilerMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AbstractOsgiCompilerMojo
public abstract class AbstractCompilerMojo extends org.apache.maven.plugin.AbstractMojoTODO: At least one step could be optimized, currently the plugin will do two scans of all the source code if the compiler has to have the entire set of sources. This is currently the case for at least the C# compiler and most likely all the other .NET compilers too.- Version:
- $Id: AbstractCompilerMojo.java 210 2007-02-20 03:02:41Z jvanzyl $
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]annotationProcessorsQualified class names of annotation processors to run.private java.io.FilebasedirThe directory to run the compiler from if fork is true.private java.io.FilebuildDirectoryThe target directory of the compiler if fork is true.private java.util.List<java.lang.String>compilerArgsArguments to be passed to the compiler.private java.lang.StringcompilerArgumentUnformatted argument string to be passed to the compiler if fork is set to true.private java.util.Map<java.lang.String,java.lang.String>compilerArgumentsDeprecated.usecompilerArgsinstead.private java.lang.StringcompilerIdThe compiler id of the compiler to use.private org.codehaus.plexus.compiler.manager.CompilerManagercompilerManagerPlexus compiler manager.private java.lang.StringcompilerVersionVersion of the compiler to use, ex.private booleandebugWhether to include debugging information in the compiled class files.static java.lang.StringDEFAULT_SOURCE_VERSIONstatic java.lang.StringDEFAULT_TARGET_VERSIONprivate java.lang.StringencodingThe -encoding argument for the Java compilerprivate java.lang.StringexecutableThe executable of the compiler to use when fork is true.private booleanfailOnWarningFail on warningsprivate booleanforkAllows running the compiler in a separate process.private java.io.FilegeneratedSourcesDirectoryThe directory where source files generated by annotation processors will be created.private java.lang.StringmavenCompilerEncodingDeprecated.useencodingprivate java.lang.Stringmaxmemmaximum size, in megabytes, of the memory allocation pool, ex.private java.lang.StringmeminitialInitial size, in megabytes, of the memory allocation pool, ex.private booleanoptimizeOptimize compiled code using the compiler's optimization methodsprivate java.lang.StringoutputFileNameUsed to control the name of the output file when compiling a set of sources to a single file.private java.lang.StringprocIf only is specified, the annotation processors will run but no compilation will be performed.protected java.lang.StringreleaseThe -release argument for the Java compilerprivate booleanshowDeprecationOutput source locations where deprecated APIs are usedprivate booleanshowWarningsOutput warningsprotected java.lang.StringsourceThe -source argument for the Java compilerprivate intstaleMillisThe granularity in milliseconds of the last modification date for testing whether a source needs recompilationprotected java.lang.StringtargetThe -target argument for the Java compilerprivate booleanverboseWhether to output messages about what the compiler is doing
-
Constructor Summary
Constructors Constructor Description AbstractCompilerMojo()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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)voidexecute()protected abstract java.util.List<java.lang.String>getClasspathElements()protected org.codehaus.plexus.compiler.CompilerConfigurationgetCompilerConfiguration(java.util.List<java.lang.String> compileSourceRoots)protected abstract java.util.List<java.lang.String>getCompileSourceRoots()private java.lang.StringgetEncoding()private java.lang.StringgetMemoryValue(java.lang.String setting)protected abstract java.io.FilegetOutputDirectory()protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScannergetSourceInclusionScanner(int staleMillis)protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScannergetSourceInclusionScanner(java.lang.String inputFileEnding)private booleanisDigits(java.lang.String string)protected static java.util.List<java.lang.String>removeEmptyCompileSourceRoots(java.util.List<java.lang.String> compileSourceRootsList)
-
-
-
Field Detail
-
DEFAULT_SOURCE_VERSION
public static final java.lang.String DEFAULT_SOURCE_VERSION
- See Also:
- Constant Field Values
-
DEFAULT_TARGET_VERSION
public static final java.lang.String DEFAULT_TARGET_VERSION
- See Also:
- Constant Field Values
-
debug
@Parameter(property="maven.compiler.debug", defaultValue="true") private boolean debugWhether to include debugging information in the compiled class files. The default value is true.
-
verbose
@Parameter(property="maven.compiler.verbose", defaultValue="false") private boolean verboseWhether to output messages about what the compiler is doing
-
showDeprecation
@Parameter(property="maven.compiler.showDeprecation", defaultValue="false") private boolean showDeprecationOutput source locations where deprecated APIs are used
-
optimize
@Parameter(property="maven.compiler.optimize", defaultValue="false") private boolean optimizeOptimize compiled code using the compiler's optimization methods
-
showWarnings
@Parameter(property="maven.compiler.showWarnings", defaultValue="false") private boolean showWarningsOutput warnings
-
failOnWarning
@Parameter(property="maven.compiler.failOnWarning", defaultValue="false") private boolean failOnWarningFail on warnings
-
source
@Parameter(property="maven.compiler.source") protected java.lang.String source
The -source argument for the Java compiler
-
target
@Parameter(property="maven.compiler.target") protected java.lang.String target
The -target argument for the Java compiler
-
release
@Parameter(property="maven.compiler.release") protected java.lang.String release
The -release argument for the Java compiler
-
mavenCompilerEncoding
@Parameter(property="maven.compiler.encoding", readonly=true) private java.lang.String mavenCompilerEncodingDeprecated.useencodingThe -encoding argument for the Java compiler (kept for backwards compatibility)
-
encoding
@Parameter(property="project.build.sourceEncoding") private java.lang.String encoding
The -encoding argument for the Java compiler
-
staleMillis
@Parameter(property="lastModGranularityMs", defaultValue="0") private int staleMillisThe granularity in milliseconds of the last modification date for testing whether a source needs recompilation
-
compilerId
@Parameter(property="maven.compiler.compilerId", defaultValue="jdt") private java.lang.String compilerIdThe compiler id of the compiler to use.
-
compilerVersion
@Parameter(property="maven.compiler.compilerVersion") private java.lang.String compilerVersion
Version of the compiler to use, ex. "1.3", "1.5", if fork is set to true
-
fork
@Parameter(defaultValue="false") private boolean fork
Allows running the compiler in a separate process. If "false" it uses the built in compiler, while if "true" it will use an executable.
-
meminitial
@Parameter(property="maven.compiler.meminitial") private java.lang.String meminitial
Initial size, in megabytes, of the memory allocation pool, ex. "64", "64m" if fork is set to true
-
maxmem
@Parameter(property="maven.compiler.maxmem") private java.lang.String maxmem
maximum size, in megabytes, of the memory allocation pool, ex. "128", "128m" if fork is set to true
-
executable
@Parameter(property="maven.compiler.executable") private java.lang.String executable
The executable of the compiler to use when fork is true.
-
proc
@Parameter private java.lang.String proc
If only is specified, the annotation processors will run but no compilation will be performed. If none is specified, annotation processors will not be discovered or run; compilation will proceed as if no annotation processors were found. By default the compiler must search the classpath for annotation processors, so specifying none may speed compilation if annotation processing is not required. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6- Since:
- 0.16.0
-
annotationProcessors
@Parameter private java.lang.String[] annotationProcessors
Qualified class names of annotation processors to run. If specified, the normal processor discovery process will be skipped. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6- Since:
- 0.16.0
-
generatedSourcesDirectory
@Parameter(defaultValue="${project.build.directory}/generated-sources/annotations") private java.io.File generatedSourcesDirectoryThe directory where source files generated by annotation processors will be created. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6.- Since:
- 0.16.0
-
compilerArguments
@Parameter private java.util.Map<java.lang.String,java.lang.String> compilerArguments
Deprecated.usecompilerArgsinstead.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.
-
compilerArgs
@Parameter private java.util.List<java.lang.String> compilerArgs
Arguments to be passed to the compiler.- Since:
- 0.17.0
-
compilerArgument
@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.
-
outputFileName
@Parameter(property="project.build.finalName") private java.lang.String outputFileName
Used to control the name of the output file when compiling a set of sources to a single file.
-
basedir
@Parameter(property="basedir", required=true, readonly=true) private java.io.File basedirThe directory to run the compiler from if fork is true.
-
buildDirectory
@Parameter(property="project.build.directory", readonly=true, required=true) private java.io.File buildDirectoryThe target directory of the compiler if fork is true.
-
compilerManager
@Component private org.codehaus.plexus.compiler.manager.CompilerManager compilerManager
Plexus compiler manager.
-
-
Method Detail
-
getSourceInclusionScanner
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(int staleMillis)
-
getSourceInclusionScanner
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(java.lang.String inputFileEnding)
-
getClasspathElements
protected abstract java.util.List<java.lang.String> getClasspathElements() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getCompileSourceRoots
protected abstract java.util.List<java.lang.String> getCompileSourceRoots() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getOutputDirectory
protected abstract java.io.File getOutputDirectory()
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getCompilerConfiguration
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- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getEncoding
private java.lang.String getEncoding()
-
getMemoryValue
private java.lang.String getMemoryValue(java.lang.String setting)
-
isDigits
private boolean isDigits(java.lang.String string)
-
computeStaleSources
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- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.codehaus.plexus.compiler.CompilerException
-
removeEmptyCompileSourceRoots
protected static java.util.List<java.lang.String> removeEmptyCompileSourceRoots(java.util.List<java.lang.String> compileSourceRootsList)
-
-