Package org.apache.maven.plugin.compiler
Class CompilerMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugin.compiler.AbstractCompilerMojo
org.apache.maven.plugin.compiler.CompilerMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="compile",
defaultPhase=COMPILE,
threadSafe=true,
requiresDependencyResolution=COMPILE)
public class CompilerMojo
extends AbstractCompilerMojo
Compiles application sources
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe source directories containing the sources to be compiled.private Stringwhen forking and debug activated the commandline used will be dumped in this fileA list of exclusion filters for the compiler.private FileSpecify where to place generated source files created by annotation processing.A list of inclusion filters for the compiler.A list of exclusion filters for the incremental calculation.(package private) final org.codehaus.plexus.languages.java.jpms.LocationManagerprivate booleanWhen set totrue, the classes will be placed inMETA-INF/versions/${release}The release value must be set, otherwise the plugin will fail.private FileThe directory for compiled classes.private org.apache.maven.artifact.ArtifactProjects main artifact.private booleanSet this to 'true' to bypass compilation of main sources.Fields inherited from class org.apache.maven.plugin.compiler.AbstractCompilerMojo
compilerArgs, compilerArgument, compilerArguments, DEFAULT_SOURCE, DEFAULT_TARGET, MODULE_INFO_TARGET, PS, release, source, targetFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddetectFilenameBasedAutomodules(org.codehaus.plexus.languages.java.jpms.ResolvePathsResult<File> resolvePathsResult, org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor moduleDescriptor) voidexecute()getCompileClasspathElements(org.apache.maven.project.MavenProject project) protected Stringprotected Stringprotected Fileprotected Fileprotected Stringprotected Stringprotected org.codehaus.plexus.compiler.util.scan.SourceInclusionScannergetSourceInclusionScanner(int staleMillis) protected org.codehaus.plexus.compiler.util.scan.SourceInclusionScannergetSourceInclusionScanner(String inputFileEnding) protected Stringprotected voidpreparePaths(Set<File> sourceFiles) private voidwriteBoxedWarning(String message) Methods inherited from class org.apache.maven.plugin.compiler.AbstractCompilerMojo
getBuildStartTime, getImplicit, getModuleDeclaration, getProject, getRequestThreadCount, getToolchain, isDependencyChanged, isTestCompile, setRelease, setTargetMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
compileSourceRoots
@Parameter(defaultValue="${project.compileSourceRoots}", readonly=false, required=true) private List<String> compileSourceRootsThe source directories containing the sources to be compiled. -
outputDirectory
@Parameter(property="maven.compiler.outputDirectory", defaultValue="${project.build.outputDirectory}", required=true, readonly=false) private File outputDirectoryThe directory for compiled classes.This parameter should only be modified in special cases. One example is creating a multi-release jar with a lower bytecode level (i.e. setting it to
${project.build.outputDirectory}/META-INF/versions/21or similar) in an additional execution.When the required bytecode level is available though an installed JDK or toolchain, it is recommended to use the
<release>property in conjunction with the ${multiReleaseOutput} parameter instead. -
projectArtifact
@Parameter(defaultValue="${project.artifact}", readonly=true, required=true) private org.apache.maven.artifact.Artifact projectArtifactProjects main artifact. -
includes
A list of inclusion filters for the compiler. -
excludes
A list of exclusion filters for the compiler. -
incrementalExcludes
A list of exclusion filters for the incremental calculation.- Since:
- 3.11
-
generatedSourcesDirectory
@Parameter(defaultValue="${project.build.directory}/generated-sources/annotations") private File generatedSourcesDirectorySpecify where to place generated source files created by annotation processing. Only applies to JDK 1.6+
- Since:
- 2.2
-
skipMain
@Parameter(property="maven.main.skip") private boolean skipMainSet this to 'true' to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on occasion. -
compilePath
-
multiReleaseOutput
@Parameter private boolean multiReleaseOutputWhen set to
Note: A jar is only a multirelease jar iftrue, the classes will be placed inMETA-INF/versions/${release}The release value must be set, otherwise the plugin will fail.META-INF/MANIFEST.MFcontainsMulti-Release: true. You need to set this by configuring the maven-jar-plugin. This implies that you cannot test a multirelease jar using the outputDirectory.- Since:
- 3.7.1
-
debugFileName
when forking and debug activated the commandline used will be dumped in this file- Since:
- 3.10.0
-
locationManager
final org.codehaus.plexus.languages.java.jpms.LocationManager locationManager -
classpathElements
-
modulepathElements
-
pathElements
-
-
Constructor Details
-
CompilerMojo
public CompilerMojo()
-
-
Method Details
-
getCompileSourceRoots
- Specified by:
getCompileSourceRootsin classAbstractCompilerMojo
-
getClasspathElements
- Specified by:
getClasspathElementsin classAbstractCompilerMojo
-
getModulepathElements
- Specified by:
getModulepathElementsin classAbstractCompilerMojo
-
getPathElements
protected Map<String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor> getPathElements()- Specified by:
getPathElementsin classAbstractCompilerMojo
-
getOutputDirectory
- Specified by:
getOutputDirectoryin classAbstractCompilerMojo
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, CompilationFailureException- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Overrides:
executein classAbstractCompilerMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionCompilationFailureException
-
getIncludes
- Specified by:
getIncludesin classAbstractCompilerMojo
-
getExcludes
- Specified by:
getExcludesin classAbstractCompilerMojo
-
preparePaths
- Specified by:
preparePathsin classAbstractCompilerMojo
-
detectFilenameBasedAutomodules
private void detectFilenameBasedAutomodules(org.codehaus.plexus.languages.java.jpms.ResolvePathsResult<File> resolvePathsResult, org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor moduleDescriptor) -
getCompileClasspathElements
-
getSourceInclusionScanner
protected org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(int staleMillis) - Specified by:
getSourceInclusionScannerin classAbstractCompilerMojo
-
getSourceInclusionScanner
protected org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding) - Specified by:
getSourceInclusionScannerin classAbstractCompilerMojo
-
getSource
- Specified by:
getSourcein classAbstractCompilerMojo
-
getTarget
- Specified by:
getTargetin classAbstractCompilerMojo
-
getRelease
- Specified by:
getReleasein classAbstractCompilerMojo
-
getCompilerArgument
- Specified by:
getCompilerArgumentin classAbstractCompilerMojo
-
getCompilerArguments
- Specified by:
getCompilerArgumentsin classAbstractCompilerMojo
-
getGeneratedSourcesDirectory
- Specified by:
getGeneratedSourcesDirectoryin classAbstractCompilerMojo
-
getDebugFileName
- Specified by:
getDebugFileNamein classAbstractCompilerMojo
-
writeBoxedWarning
-