Class AbstractCompilerMojo
- All Implemented Interfaces:
- org.apache.maven.plugin.ContextEnabled,- org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
- CompilerMojo,- TestCompilerMojo
- Since:
- 2.0
- Author:
- others, Trygve Laugstøl
- 
Field SummaryFieldsModifier and TypeFieldDescriptionSets the arguments to be passed to the compiler.protected StringSets the unformatted single argument string to be passed to the compiler.Deprecated.protected static final Stringprotected StringThe-releaseargument for the Java compiler, supported since Java9protected StringThe-sourceargument for the Java compiler.protected StringThe-targetargument for the Java compiler.Fields inherited from interface org.apache.maven.plugin.MojoROLE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidexecute()protected Dateprotected abstract Stringprotected abstract Stringprotected abstract FilegetModuleDeclaration(Set<File> sourceFiles) protected abstract Fileprotected final org.apache.maven.project.MavenProjectprotected abstract Stringprotected inttry to get thread count if a Maven 3 build, using reflection as the plugin must not be maven3 api dependentprotected abstract Stringprotected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScannergetSourceInclusionScanner(int staleMillis) protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScannergetSourceInclusionScanner(String inputFileEnding) protected abstract Stringprotected final org.apache.maven.toolchain.Toolchainprotected booleanWe just compare the timestamps of all local dependency files (inter-module dependency classpath) and the own generated classes and if we got a file which is >= the build-started timestamp, then we caught a file which got changed during this build.protected booleanprotected abstract voidpreparePaths(Set<File> sourceFiles) voidsetRelease(String release) voidMethods inherited from class org.apache.maven.plugin.AbstractMojogetLog, getPluginContext, setLog, setPluginContext
- 
Field Details- 
PS
- 
sourceThe -sourceargument for the Java compiler.NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6 Since 3.9.0 the default value has changed from 1.6 to 1.7 Since 3.11.0 the default value has changed from 1.7 to 1.8 - See Also:
 
- 
targetThe -targetargument for the Java compiler.NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6 Since 3.9.0 the default value has changed from 1.6 to 1.7 Since 3.11.0 the default value has changed from 1.7 to 1.8 - See Also:
 
- 
releaseThe-releaseargument for the Java compiler, supported since Java9- Since:
- 3.6
- See Also:
 
- 
compilerArgumentsDeprecated.usecompilerArgsinstead.Sets the arguments to be passed to the compiler (prepending a dash). This is because the list of valid arguments passed to a Java compiler varies based on the compiler version. Note that -Joptions are only passed through ifforkis set totrue.To pass -Xmaxerrs 1000 -Xlint -Xlint:-path -Averbose=trueyou should include the following:<compilerArguments> <Xmaxerrs>1000</Xmaxerrs> <Xlint/> <Xlint:-path/> <Averbose>true</Averbose> </compilerArguments> - Since:
- 2.0.1
 
- 
compilerArgsSets the arguments to be passed to the compiler. Note that Example:-Joptions are only passed through ifforkis set totrue.<compilerArgs> <arg>-Xmaxerrs</arg> <arg>1000</arg> <arg>-Xlint</arg> <arg>-J-Duser.language=en_us</arg> </compilerArgs> - Since:
- 3.1
- See Also:
 
- 
compilerArgumentSets the unformatted single argument string to be passed to the compiler. To pass multiple arguments such as -Xmaxerrs 1000(which are actually two arguments) you have to usecompilerArgs.This is because the list of valid arguments passed to a Java compiler varies based on the compiler version. Note that -Joptions are only passed through ifforkis set totrue.- See Also:
 
 
- 
- 
Constructor Details- 
AbstractCompilerMojopublic AbstractCompilerMojo()
 
- 
- 
Method Details- 
getSourceInclusionScannerprotected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(int staleMillis) 
- 
getSourceInclusionScannerprotected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding) 
- 
getClasspathElements
- 
getModulepathElements
- 
getPathElements
- 
getCompileSourceRoots
- 
preparePaths
- 
getOutputDirectory
- 
getSource
- 
getTarget
- 
getRelease
- 
getCompilerArgument
- 
getCompilerArguments
- 
getGeneratedSourcesDirectory
- 
getDebugFileName
- 
getProjectprotected final org.apache.maven.project.MavenProject getProject()
- 
getModuleDeclaration
- 
executepublic void execute() throws org.apache.maven.plugin.MojoExecutionException, CompilationFailureException- Throws:
- org.apache.maven.plugin.MojoExecutionException
- CompilationFailureException
 
- 
isTestCompileprotected boolean isTestCompile()
- 
getIncludes
- 
getExcludes
- 
getRequestThreadCountprotected int getRequestThreadCount()try to get thread count if a Maven 3 build, using reflection as the plugin must not be maven3 api dependent- Returns:
- number of thread for this build or 1 if not multi-thread build
 
- 
getBuildStartTime
- 
getToolchainprotected final org.apache.maven.toolchain.Toolchain getToolchain()
- 
isDependencyChangedprotected boolean isDependencyChanged()We just compare the timestamps of all local dependency files (inter-module dependency classpath) and the own generated classes and if we got a file which is >= the build-started timestamp, then we caught a file which got changed during this build.- Returns:
- trueif at least one single dependency has changed.
 
- 
setTarget
- 
setRelease
 
- 
compilerArgsinstead.