org.apache.maven.plugin
Class AbstractCompilerMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.AbstractCompilerMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
CompilerMojo, TestCompilerMojo

public abstract class AbstractCompilerMojo
extends AbstractMojo

TODO: 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.

Since:
2.0
Version:
$Id: AbstractCompilerMojo.html 816619 2012-05-08 13:09:26Z hboutemy $
Author:
others, Trygve Laugstøl

Field Summary
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
           Sets the arguments to be passed to the compiler (prepending a dash) if fork is set to true.
protected  String source
          The -source argument for the Java compiler.
protected  String target
          The -target argument for the Java compiler.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractCompilerMojo()
           
 
Method Summary
 void execute()
           
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  File getOutputDirectory()
           
protected abstract  String getSource()
           
protected abstract  SourceInclusionScanner getSourceInclusionScanner(int staleMillis)
           
protected abstract  SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding)
           
protected abstract  String getTarget()
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected String source
The -source argument for the Java compiler.

Is defined by:
expression:
${maven.compiler.source}
default-value:
1.5

target

protected String target
The -target argument for the Java compiler.

Is defined by:
expression:
${maven.compiler.target}
default-value:
1.5

compilerArguments

protected Map<String,String> compilerArguments

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>
 

Since:
2.0.1
Is defined by:

compilerArgument

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.

Is defined by:
Constructor Detail

AbstractCompilerMojo

public AbstractCompilerMojo()
Method Detail

getSourceInclusionScanner

protected abstract SourceInclusionScanner getSourceInclusionScanner(int staleMillis)

getSourceInclusionScanner

protected abstract SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding)

getClasspathElements

protected abstract List<String> getClasspathElements()

getCompileSourceRoots

protected abstract List<String> getCompileSourceRoots()

getOutputDirectory

protected abstract File getOutputDirectory()

getSource

protected abstract String getSource()

getTarget

protected abstract String getTarget()

getCompilerArgument

protected abstract String getCompilerArgument()

getCompilerArguments

protected abstract Map<String,String> getCompilerArguments()

getGeneratedSourcesDirectory

protected abstract File getGeneratedSourcesDirectory()

execute

public void execute()
             throws MojoExecutionException,
                    CompilationFailureException
Throws:
MojoExecutionException
CompilationFailureException


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.