org.codehaus.mojo.aspectj
Class AbstractAjcCompiler

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.aspectj.AbstractAjcMojo
          extended by org.codehaus.mojo.aspectj.AbstractAjcCompiler
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AjcCompileMojo, AjcTestCompileMojo

public abstract class AbstractAjcCompiler
extends AbstractAjcMojo

Base class for the two aspectJ compiletime weaving mojos.

Author:
Kaare Nilsen

Field Summary
protected  java.util.List ajcOptions
          Holder for ajc compiler options
protected  java.lang.String ajdtBuildDefFile
          Where to find the ajdt build definition file.
protected  java.lang.String argumentFileName
          The filename to store build configuration in.
protected  java.lang.String aspectDirectory
          The source directory for the aspects
protected  Module[] aspectLibraries
          Weave binary aspects from the jars.
protected  java.lang.String bootclasspath
          Override location of VM's bootclasspath for purposes of evaluating types when compiling.
protected  java.lang.String complianceLevel
          Specify compiler compliance setting (1.3 to 1.5) default is 1.4
protected  boolean deprecation
          Toggle warningmessages on deprecations
protected  boolean emacssym
          Generate .ajesym symbol files for emacs support
protected  java.lang.String encoding
          Specify default source encoding format.
protected  java.lang.String[] excludes
          List of ant-style patterns used to specify the aspects that should be excluded when compiling.
protected  java.lang.String[] includes
          List of ant-style patterns used to specify the aspects that should be included when compiling.
protected  boolean noImportError
          Emit no errors for unresolved imports;
protected  boolean outxml
          Generate aop.xml file for load-time weaving with default name.(/META-INF/aop.xml)
protected  java.lang.String outxmlfile
          Generate aop.xml file for load-time weaving with custom name.
protected  boolean preserveAllLocals
          Preserve all local variables during code generation (to facilitate debugging).
protected  boolean proceedOnError
          Keep compiling after error, dumping class files with problem methods
protected  boolean referenceInfo
          Compute reference information.
protected  int repeat
          Repeat compilation process N times (typically to do performance analysis).
protected  java.util.Set resolvedIncludes
          Holds all files found using the includes, excludes parameters.
protected  boolean showWeaveInfo
          Emit messages about weaving
protected  java.lang.String source
          Toggle assertions (1.3, 1.4, or 1.5 - default is 1.4).
protected  java.lang.String target
          Specify classfile target setting (1.1 to 1.5) default is 1.2
protected  java.lang.String testAspectDirectory
          The source directory for the test aspects
protected  boolean verbose
          Emit messages about accessed/processed compilation units
protected  java.lang.String warn
          Emit warnings for any instances of the comma-delimited list of questionable code (eg 'unusedLocals,deprecation'): see http://www.eclipse.org/aspectj/doc/released/devguide/ajc-ref.html#ajc for available settings
protected  Module[] weaveDependencies
          List of of modules to weave (into target directory).
protected  boolean XaddSerialVersionUID
          Causes the compiler to calculate and add the SerialVersionUID field to any type implementing Serializable that is affected by an aspect.
protected  java.lang.String Xlint
          Set default level for messages about potential programming mistakes in crosscutting code.
protected  boolean XnoInline
          (Experimental) do not inline around advice
protected  boolean Xreweavable
          (Experimental) runs weaver in reweavable mode which causes it to create woven classes that can be rewoven, subject to the restriction that on attempting a reweave all the types that advised the woven type must be accessible.
protected  boolean XserializableAspects
          (Experimental) Normally it is an error to declare aspects Serializable.
 
Fields inherited from class org.codehaus.mojo.aspectj.AbstractAjcMojo
basedir, project
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractAjcCompiler()
           
 
Method Summary
protected  void assembleArguments()
          Assembles a complete ajc compiler arguments list.
 void execute()
          Do the AspectJ compiling.
protected abstract  java.lang.String getAdditionalAspectPaths()
          Abstract method used by cild classes to specify aditional aspect paths.
protected abstract  java.util.List getOutputDirectories()
          Abstract method used by child classes to spesify the correct output directory for compiled classes.
protected abstract  java.util.List getSourceDirectories()
          Abstract method used by child classes to spesify the correct source directory for classes.
protected  boolean isBuildNeeded()
          Checks modifications that would make us need a build
 void setArgumentFileName(java.lang.String argumentFileName)
           
 void setBootClassPath(java.lang.String bootclasspath)
           
 void setComplianceLevel(java.lang.String complianceLevel)
          Setters which when called sets compiler arguments
 void setDeprecation(boolean deprecation)
           
 void setEmacssym(boolean emacssym)
           
 void setEncoding(java.lang.String encoding)
           
 void setNoImportError(boolean noImportError)
           
 void setOutxml(boolean outxml)
           
 void setOutxmlfile(java.lang.String outxmlfile)
           
 void setPreserveAllLocals(boolean preserveAllLocals)
           
 void setProceedOnError(boolean proceedOnError)
           
 void setReferenceInfo(boolean referenceInfo)
           
 void setRepeat(int repeat)
           
 void setShowWeaveInfo(boolean showWeaveInfo)
           
 void setSource(java.lang.String source)
           
 void setTarget(java.lang.String target)
           
 void setVerbose(boolean verbose)
           
 void setWarn(java.lang.String warn)
           
 void setXaddSerialVersionUID(boolean xaddSerialVersionUID)
           
 void setXlint(java.lang.String xlint)
           
 void setXnoInline(boolean xnoInline)
           
 void setXreweavable(boolean xreweavable)
           
 void setXserializableAspects(boolean xserializableAspects)
           
 
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

aspectDirectory

protected java.lang.String aspectDirectory
The source directory for the aspects


testAspectDirectory

protected java.lang.String testAspectDirectory
The source directory for the test aspects


includes

protected java.lang.String[] includes
List of ant-style patterns used to specify the aspects that should be included when compiling. When none specified all .java and .aj files in the project source directories, or directories spesified by the ajdtDefFile property are included. * @parameter


excludes

protected java.lang.String[] excludes
List of ant-style patterns used to specify the aspects that should be excluded when compiling. When none specified all .java and .aj files in the project source directories, or directories spesified by the ajdtDefFile property are included. * @parameter


ajdtBuildDefFile

protected java.lang.String ajdtBuildDefFile
Where to find the ajdt build definition file. If set this will override the use of project sourcedirs.


weaveDependencies

protected Module[] weaveDependencies
List of of modules to weave (into target directory). Corresponds to ajc -inpath option (or -injars for pre-1.2 (which is not supported)).


aspectLibraries

protected Module[] aspectLibraries
Weave binary aspects from the jars. The aspects should have been output by the same version of the compiler. The modules must also be dependencies of the project. Corresponds to ajc -aspectpath option


outxml

protected boolean outxml
Generate aop.xml file for load-time weaving with default name.(/META-INF/aop.xml)


outxmlfile

protected java.lang.String outxmlfile
Generate aop.xml file for load-time weaving with custom name.


emacssym

protected boolean emacssym
Generate .ajesym symbol files for emacs support


Xlint

protected java.lang.String Xlint
Set default level for messages about potential programming mistakes in crosscutting code. {level} may be ignore, warning, or error. This overrides entries in org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar.


target

protected java.lang.String target
Specify classfile target setting (1.1 to 1.5) default is 1.2


source

protected java.lang.String source
Toggle assertions (1.3, 1.4, or 1.5 - default is 1.4). When using -source 1.3, an assert() statement valid under Java 1.4 will result in a compiler error. When using -source 1.4, treat assert as a keyword and implement assertions according to the 1.4 language spec. When using -source 1.5, Java 5 language features are permitted.


complianceLevel

protected java.lang.String complianceLevel
Specify compiler compliance setting (1.3 to 1.5) default is 1.4


deprecation

protected boolean deprecation
Toggle warningmessages on deprecations


noImportError

protected boolean noImportError
Emit no errors for unresolved imports;


proceedOnError

protected boolean proceedOnError
Keep compiling after error, dumping class files with problem methods


preserveAllLocals

protected boolean preserveAllLocals
Preserve all local variables during code generation (to facilitate debugging).


referenceInfo

protected boolean referenceInfo
Compute reference information.


encoding

protected java.lang.String encoding
Specify default source encoding format.


verbose

protected boolean verbose
Emit messages about accessed/processed compilation units


showWeaveInfo

protected boolean showWeaveInfo
Emit messages about weaving


repeat

protected int repeat
Repeat compilation process N times (typically to do performance analysis).


Xreweavable

protected boolean Xreweavable
(Experimental) runs weaver in reweavable mode which causes it to create woven classes that can be rewoven, subject to the restriction that on attempting a reweave all the types that advised the woven type must be accessible.


XnoInline

protected boolean XnoInline
(Experimental) do not inline around advice


XserializableAspects

protected boolean XserializableAspects
(Experimental) Normally it is an error to declare aspects Serializable. This option removes that restriction.


XaddSerialVersionUID

protected boolean XaddSerialVersionUID
Causes the compiler to calculate and add the SerialVersionUID field to any type implementing Serializable that is affected by an aspect. The field is calculated based on the class before weaving has taken place.


bootclasspath

protected java.lang.String bootclasspath
Override location of VM's bootclasspath for purposes of evaluating types when compiling. Path is a single argument containing a list of paths to zip files or directories, delimited by the platform-specific path delimiter.


warn

protected java.lang.String warn
Emit warnings for any instances of the comma-delimited list of questionable code (eg 'unusedLocals,deprecation'): see http://www.eclipse.org/aspectj/doc/released/devguide/ajc-ref.html#ajc for available settings


argumentFileName

protected java.lang.String argumentFileName
The filename to store build configuration in. This file will be placed in the project build output directory, and will contain all the arguments passed to the compiler in the last run, and also all the filenames included in the build. Aspects as well as java files.


ajcOptions

protected java.util.List ajcOptions
Holder for ajc compiler options


resolvedIncludes

protected java.util.Set resolvedIncludes
Holds all files found using the includes, excludes parameters.

Constructor Detail

AbstractAjcCompiler

public AbstractAjcCompiler()
Method Detail

getOutputDirectories

protected abstract java.util.List getOutputDirectories()
Abstract method used by child classes to spesify the correct output directory for compiled classes.

Returns:
where compiled classes should be put.

getSourceDirectories

protected abstract java.util.List getSourceDirectories()
Abstract method used by child classes to spesify the correct source directory for classes.

Returns:
where sources may be found.

getAdditionalAspectPaths

protected abstract java.lang.String getAdditionalAspectPaths()
Abstract method used by cild classes to specify aditional aspect paths.

Returns:

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Do the AspectJ compiling.

Throws:
org.apache.maven.plugin.MojoExecutionException

assembleArguments

protected void assembleArguments()
                          throws org.apache.maven.plugin.MojoExecutionException
Assembles a complete ajc compiler arguments list.

Throws:
org.apache.maven.plugin.MojoExecutionException - error in configuration

isBuildNeeded

protected boolean isBuildNeeded()
                         throws org.apache.maven.plugin.MojoExecutionException
Checks modifications that would make us need a build

Throws:
org.apache.maven.plugin.MojoExecutionException

setComplianceLevel

public void setComplianceLevel(java.lang.String complianceLevel)
Setters which when called sets compiler arguments


setDeprecation

public void setDeprecation(boolean deprecation)

setEmacssym

public void setEmacssym(boolean emacssym)

setEncoding

public void setEncoding(java.lang.String encoding)

setNoImportError

public void setNoImportError(boolean noImportError)

setOutxml

public void setOutxml(boolean outxml)

setOutxmlfile

public void setOutxmlfile(java.lang.String outxmlfile)

setPreserveAllLocals

public void setPreserveAllLocals(boolean preserveAllLocals)

setProceedOnError

public void setProceedOnError(boolean proceedOnError)

setReferenceInfo

public void setReferenceInfo(boolean referenceInfo)

setRepeat

public void setRepeat(int repeat)

setShowWeaveInfo

public void setShowWeaveInfo(boolean showWeaveInfo)

setTarget

public void setTarget(java.lang.String target)

setSource

public void setSource(java.lang.String source)

setVerbose

public void setVerbose(boolean verbose)

setXlint

public void setXlint(java.lang.String xlint)

setXnoInline

public void setXnoInline(boolean xnoInline)

setXreweavable

public void setXreweavable(boolean xreweavable)

setXserializableAspects

public void setXserializableAspects(boolean xserializableAspects)

setXaddSerialVersionUID

public void setXaddSerialVersionUID(boolean xaddSerialVersionUID)

setBootClassPath

public void setBootClassPath(java.lang.String bootclasspath)

setWarn

public void setWarn(java.lang.String warn)

setArgumentFileName

public void setArgumentFileName(java.lang.String argumentFileName)


Copyright © 2005-2009. All Rights Reserved.