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
- Direct Known Subclasses:
CompilerMojo
@Mojo(name="compile", defaultPhase=COMPILE, threadSafe=true, requiresDependencyResolution=COMPILE) public class CompilerMojo extends AbstractCompilerMojo
Compiles application sources- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
classpathElements
private java.util.List<java.lang.String>
compilePath
private java.util.List<java.lang.String>
compileSourceRoots
The source directories containing the sources to be compiled.private java.util.Set<java.lang.String>
excludes
A list of exclusion filters for the compiler.private java.io.File
generatedSourcesDirectory
Specify where to place generated source files created by annotation processing.private java.util.Set<java.lang.String>
includes
A list of inclusion filters for the compiler.private org.codehaus.plexus.languages.java.jpms.LocationManager
locationManager
private java.util.List<java.lang.String>
modulepathElements
private boolean
multiReleaseOutput
When set totrue
, the classes will be placed inMETA-INF/versions/${release}
The release value must be set, otherwise the plugin will fail.private java.io.File
outputDirectory
The directory for compiled classes.private java.util.Map<java.lang.String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor>
pathElements
private org.apache.maven.artifact.Artifact
projectArtifact
Projects main artifact.private boolean
skipMain
Set 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, target
-
-
Constructor Summary
Constructors Constructor Description CompilerMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
detectFilenameBasedAutomodules(org.codehaus.plexus.languages.java.jpms.ResolvePathsResult<java.io.File> resolvePathsResult, org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor moduleDescriptor)
void
execute()
protected java.util.List<java.lang.String>
getClasspathElements()
private java.util.List<java.io.File>
getCompileClasspathElements(org.apache.maven.project.MavenProject project)
protected java.lang.String
getCompilerArgument()
protected java.util.Map<java.lang.String,java.lang.String>
getCompilerArguments()
protected java.util.List<java.lang.String>
getCompileSourceRoots()
protected java.io.File
getGeneratedSourcesDirectory()
protected java.util.List<java.lang.String>
getModulepathElements()
protected java.io.File
getOutputDirectory()
protected java.util.Map<java.lang.String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor>
getPathElements()
protected java.lang.String
getRelease()
protected java.lang.String
getSource()
protected org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner
getSourceInclusionScanner(int staleMillis)
protected org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner
getSourceInclusionScanner(java.lang.String inputFileEnding)
protected java.lang.String
getTarget()
protected void
preparePaths(java.util.Set<java.io.File> sourceFiles)
private void
writeBoxedWarning(java.lang.String message)
-
Methods inherited from class org.apache.maven.plugin.compiler.AbstractCompilerMojo
convertToCompilerResult, getBuildStartTime, getProject, getRequestThreadCount, getToolchain, isDependencyChanged, isTestCompile, setRelease, setTarget
-
-
-
-
Field Detail
-
compileSourceRoots
@Parameter(defaultValue="${project.compileSourceRoots}", readonly=true, required=true) private java.util.List<java.lang.String> compileSourceRoots
The source directories containing the sources to be compiled.
-
outputDirectory
@Parameter(defaultValue="${project.build.outputDirectory}", required=true, readonly=true) private java.io.File outputDirectory
The directory for compiled classes.
-
projectArtifact
@Parameter(defaultValue="${project.artifact}", readonly=true, required=true) private org.apache.maven.artifact.Artifact projectArtifact
Projects main artifact.
-
includes
@Parameter private java.util.Set<java.lang.String> includes
A list of inclusion filters for the compiler.
-
excludes
@Parameter private java.util.Set<java.lang.String> excludes
A list of exclusion filters for the compiler.
-
generatedSourcesDirectory
@Parameter(defaultValue="${project.build.directory}/generated-sources/annotations") private java.io.File generatedSourcesDirectory
Specify 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 skipMain
Set this to 'true' to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on occasion.
-
compilePath
@Parameter(defaultValue="${project.compileClasspathElements}", readonly=true, required=true) private java.util.List<java.lang.String> compilePath
-
multiReleaseOutput
@Parameter private boolean multiReleaseOutput
When set totrue
, the classes will be placed inMETA-INF/versions/${release}
The release value must be set, otherwise the plugin will fail.- Since:
- 3.7.1
-
locationManager
@Component private org.codehaus.plexus.languages.java.jpms.LocationManager locationManager
-
classpathElements
private java.util.List<java.lang.String> classpathElements
-
modulepathElements
private java.util.List<java.lang.String> modulepathElements
-
pathElements
private java.util.Map<java.lang.String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor> pathElements
-
-
Method Detail
-
getCompileSourceRoots
protected java.util.List<java.lang.String> getCompileSourceRoots()
- Specified by:
getCompileSourceRoots
in classAbstractCompilerMojo
-
getClasspathElements
protected java.util.List<java.lang.String> getClasspathElements()
- Specified by:
getClasspathElements
in classAbstractCompilerMojo
-
getModulepathElements
protected java.util.List<java.lang.String> getModulepathElements()
- Specified by:
getModulepathElements
in classAbstractCompilerMojo
-
getPathElements
protected java.util.Map<java.lang.String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor> getPathElements()
- Specified by:
getPathElements
in classAbstractCompilerMojo
-
getOutputDirectory
protected java.io.File getOutputDirectory()
- Specified by:
getOutputDirectory
in classAbstractCompilerMojo
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, CompilationFailureException
- Specified by:
execute
in interfaceorg.apache.maven.plugin.Mojo
- Overrides:
execute
in classAbstractCompilerMojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
CompilationFailureException
-
preparePaths
protected void preparePaths(java.util.Set<java.io.File> sourceFiles)
- Specified by:
preparePaths
in classAbstractCompilerMojo
-
detectFilenameBasedAutomodules
private void detectFilenameBasedAutomodules(org.codehaus.plexus.languages.java.jpms.ResolvePathsResult<java.io.File> resolvePathsResult, org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor moduleDescriptor)
-
getCompileClasspathElements
private java.util.List<java.io.File> getCompileClasspathElements(org.apache.maven.project.MavenProject project)
-
getSourceInclusionScanner
protected org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(int staleMillis)
- Specified by:
getSourceInclusionScanner
in classAbstractCompilerMojo
-
getSourceInclusionScanner
protected org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner getSourceInclusionScanner(java.lang.String inputFileEnding)
- Specified by:
getSourceInclusionScanner
in classAbstractCompilerMojo
-
getSource
protected java.lang.String getSource()
- Specified by:
getSource
in classAbstractCompilerMojo
-
getTarget
protected java.lang.String getTarget()
- Specified by:
getTarget
in classAbstractCompilerMojo
-
getRelease
protected java.lang.String getRelease()
- Specified by:
getRelease
in classAbstractCompilerMojo
-
getCompilerArgument
protected java.lang.String getCompilerArgument()
- Specified by:
getCompilerArgument
in classAbstractCompilerMojo
-
getCompilerArguments
protected java.util.Map<java.lang.String,java.lang.String> getCompilerArguments()
- Specified by:
getCompilerArguments
in classAbstractCompilerMojo
-
getGeneratedSourcesDirectory
protected java.io.File getGeneratedSourcesDirectory()
- Specified by:
getGeneratedSourcesDirectory
in classAbstractCompilerMojo
-
writeBoxedWarning
private void writeBoxedWarning(java.lang.String message)
-
-