public abstract class AbstractCompilerMojo extends AbstractMojo
Modifier and Type | Field and Description |
---|---|
protected List<String> |
compilerArgs
Sets the arguments to be passed to the compiler if
fork is set to true . |
protected String |
compilerArgument
Sets the unformatted single argument string to be passed to the compiler if
fork is set to
true . |
protected Map<String,String> |
compilerArguments
Deprecated.
use
compilerArgs instead. |
protected static String |
PS |
protected String |
release
The -release argument for the Java compiler, supported since Java9
|
protected String |
source
The -source argument for the Java compiler.
|
protected String |
target
The -target argument for the Java compiler.
|
Constructor and Description |
---|
AbstractCompilerMojo() |
Modifier and Type | Method and Description |
---|---|
protected org.codehaus.plexus.compiler.CompilerResult |
convertToCompilerResult(List<org.codehaus.plexus.compiler.CompilerError> compilerErrors) |
void |
execute() |
protected Date |
getBuildStartTime() |
protected abstract List<String> |
getClasspathElements() |
protected abstract String |
getCompilerArgument() |
protected abstract Map<String,String> |
getCompilerArguments() |
protected abstract List<String> |
getCompileSourceRoots() |
protected abstract File |
getGeneratedSourcesDirectory() |
protected abstract List<String> |
getModulepathElements() |
protected abstract File |
getOutputDirectory() |
protected abstract Map<String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor> |
getPathElements() |
protected MavenProject |
getProject() |
protected abstract String |
getRelease() |
protected int |
getRequestThreadCount()
try to get thread count if a Maven 3 build, using reflection as the plugin must not be maven3 api dependent
|
protected abstract String |
getSource() |
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner |
getSourceInclusionScanner(int staleMillis) |
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner |
getSourceInclusionScanner(String inputFileEnding) |
protected abstract String |
getTarget() |
protected Toolchain |
getToolchain() |
protected 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 buid-started timestamp, then we catched a file which
got changed during this build.
|
protected boolean |
isTestCompile() |
protected abstract void |
preparePaths(Set<File> sourceFiles) |
void |
setRelease(String release) |
void |
setTarget(String target) |
getLog, getPluginContext, setLog, setPluginContext
protected static final String PS
@Parameter(property="maven.compiler.source", defaultValue="1.6") protected String source
The -source argument for the Java compiler.
NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6@Parameter(property="maven.compiler.target", defaultValue="1.6") protected String target
The -target argument for the Java compiler.
NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6@Parameter(property="maven.compiler.release") protected String release
@Parameter @Deprecated protected Map<String,String> compilerArguments
compilerArgs
instead.
Sets the 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.
To pass -Xmaxerrs 1000 -Xlint -Xlint:-path -Averbose=true
you should include the following:
<compilerArguments> <Xmaxerrs>1000</Xmaxerrs> <Xlint/> <Xlint:-path/> <Averbose>true</Averbose> </compilerArguments>
@Parameter protected List<String> compilerArgs
Sets the arguments to be passed to the compiler if fork
is set to true
.
Example:
<compilerArgs> <arg>-Xmaxerrs</arg> <arg>1000</arg> <arg>-Xlint</arg> <arg>-J-Duser.language=en_us</arg> </compilerArgs>
@Parameter protected String compilerArgument
Sets the unformatted single argument string to be passed to the compiler if fork
is set to
true
. To pass multiple arguments such as -Xmaxerrs 1000
(which are actually two
arguments) you have to use compilerArguments
.
This is because the list of valid arguments passed to a Java compiler varies based on the compiler version.
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(int staleMillis)
protected abstract org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding)
protected abstract Map<String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor> getPathElements()
protected abstract File getOutputDirectory()
protected abstract String getSource()
protected abstract String getTarget()
protected abstract String getRelease()
protected abstract String getCompilerArgument()
protected abstract File getGeneratedSourcesDirectory()
protected final MavenProject getProject()
public void execute() throws MojoExecutionException, CompilationFailureException
protected boolean isTestCompile()
protected org.codehaus.plexus.compiler.CompilerResult convertToCompilerResult(List<org.codehaus.plexus.compiler.CompilerError> compilerErrors)
protected int getRequestThreadCount()
protected Date getBuildStartTime()
protected final Toolchain getToolchain()
protected boolean isDependencyChanged()
true
if at least one single dependency has changed.public void setTarget(String target)
public void setRelease(String release)
Copyright © 2001–2019 The Apache Software Foundation. All rights reserved.