aspectj:compile

Full name:

org.codehaus.mojo:aspectj-maven-plugin:1.5:compile

Description:

Weaves all main classes.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: compile.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: compile.

Optional Parameters

Name Type Since Description
XaddSerialVersionUID boolean - 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.
Xajruntimetarget String - (Experimental) Allows code to be generated that targets a 1.2 or a 1.5 level AspectJ runtime (default 1.5)
XhasMember boolean 1.3 Enables the compiler to support hasmethod(method_pattern) and hasfield(field_pattern) type patterns, but only within declare statements. It's experimental and undocumented because it may change, and because it doesn't yet take into account ITDs.
Xjoinpoints String - supply a comma separated list of new joinpoints that can be identified by pointcuts. Values are: arrayconstruction, synchronization
Xlint String - 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.
Xlintfile File - Specify properties file to set levels for specific crosscutting messages. PropertyFile is a path to a Java .properties file that takes the same property names and values as org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, which it also overrides.
XnoInline boolean - (Experimental) do not inline around advice
XnotReweavable boolean - (Experimental) Create class files that can't be subsequently rewoven by AspectJ.
Xreweavable boolean - (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.
XserializableAspects boolean - (Experimental) Normally it is an error to declare aspects Serializable. This option removes that restriction.
Xset Map 1.5 Allows the caller to provide additional arguments in a Map format. For example:
<configuration>
  <Xset>
    <overWeaving>true</overWeaving>
    <avoidFinal>false</avoidFinal>
  </Xset>
</configuration>

XterminateAfterCompilation boolean - Causes compiler to terminate before weaving
ajdtBuildDefFile String - Where to find the ajdt build definition file. If set this will override the use of project sourcedirs.
argumentFileName String - The filename holding AJC build arguments. The file will be placed in the project build output directory, and will contain all the arguments passed to the AJC compiler in the last run, and also all the files included in the AJC build. Sample content shown below to illustrate typical content within the builddef.lst file:
    
-1.6
-encoding
UTF-8
-classpath
/Users/lj/Development/Projects/Nazgul/nazgul_tools/validation/validation-api/target/nazgul-tools-validation-api-2.0.10-SNAPSHOT.jar:/Users/lj/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:/Users/lj/.m2/repository/org/aspectj/aspectjrt/1.7.3/aspectjrt-1.7.3.jar:/Users/lj/.m2/repository/junit/junit/4.11/junit-4.11.jar:/Users/lj/.m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar:/Users/lj/.m2/repository/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar:/Users/lj/Development/Projects/Nazgul/nazgul_tools/validation/validation-aspect/target/classes
-d
/Users/lj/Development/Projects/Nazgul/nazgul_tools/validation/validation-aspect/target/classes
/Users/lj/Development/Projects/Nazgul/nazgul_tools/validation/validation-aspect/src/main/java/se/jguru/nazgul/tools/validation/aspect/ValidationAspect.java
    

Default value is: builddef.lst.
aspectDirectory String - The source directory for the aspects.
Default value is: src/main/aspect.
aspectLibraries Module[] - 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
bootclasspath String - 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.
complianceLevel String - Specify compiler compliance setting. Defaults to 1.4, with permitted values ("1.3", "1.4", "1.5", "1.6" and "1.7").
Default value is: 1.4.
crossrefs boolean - generate .ajsym file into the output directory
deprecation boolean - Toggle warningmessages on deprecations
emacssym boolean - Generate .ajesym symbol files for emacs support.
encoding String - Specify default source encoding format.
User property is: project.build.sourceEncoding.
excludes String[] - 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 specified by the ajdtDefFile property are included.
forceAjcCompile boolean - Forces re-compilation, regardless of whether the compiler arguments or the sources have changed.
Default value is: false.
includes String[] - 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 specified by the ajdtDefFile property are included.
noImportError boolean - Emit no errors for unresolved imports;
outxml boolean - Generate aop.xml file for load-time weaving with default name (/META-INF/aop.xml).
outxmlfile String - Generate aop.xml file for load-time weaving with custom name.
preserveAllLocals boolean - Preserve all local variables during code generation (to facilitate debugging).
proceedOnError boolean - Keep compiling after error, dumping class files with problem methods
referenceInfo boolean - Compute reference information.
repeat int - Repeat compilation process N times (typically to do performance analysis).
showWeaveInfo boolean - Emit messages about weaving
skip boolean - Skip plugin execution.
Default value is: false.
User property is: aspectj.skip.
source String - Toggle assertions (1.3, 1.4, 1.5, 1.6 or 1.7 - 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 or higher, Java 5 language features are permitted. With --source 1.7 or higher Java 7 features are supported.
Default value is: ${mojo.java.target}.
sources Scanner[] 1.4

Set the java source folders to use, specifying the includes and excludes.

If you don't specify this parameter, all java sources of the current project fill be used. If you specify this parameter as an empty tag (i.e. <sources/>), all source folders will be ignored. Otherwise specify the source folder(s) to use.


target String - Specify classfile target setting (1.1 to 1.7) default is 1.2
Default value is: ${project.build.java.target}.
testAspectDirectory String - The source directory for the test aspects.
Default value is: src/test/aspect.
verbose boolean - Emit messages about accessed/processed compilation units
warn String - Emit warnings for any instances of the comma-delimited list of questionable code. Supported values are shown in the list below, with their respective explanations - as copied directly from the AJC reference.
constructorName
method with constructor name
packageDefaultMethod
attempt to override package-default method
deprecation
usage of deprecated type or member
maskedCatchBlocks
hidden catch block
unusedLocals
local variable never read
unusedArguments
method argument never read
unusedImports
import statement not used by code in file
none
suppress all compiler warnings

weaveDependencies Module[] - List of of modules to weave (into target directory). Corresponds to ajc -inpath option (or -injars for pre-1.2 (which is not supported)).
weaveDirectories String[] 1.4 List of of directories with .class files to weave (into target directory). Corresponds to ajc -inpath option.
xmlConfigured File - Parameter which indicates an XML file containing AspectJ weaving instructions. Assigning this plugin parameter adds the -xmlConfigured option to ajc.

Parameter Details

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.
  • Type: boolean
  • Required: No

Xajruntimetarget:

(Experimental) Allows code to be generated that targets a 1.2 or a 1.5 level AspectJ runtime (default 1.5)
  • Type: java.lang.String
  • Required: No

XhasMember:

Enables the compiler to support hasmethod(method_pattern) and hasfield(field_pattern) type patterns, but only within declare statements. It's experimental and undocumented because it may change, and because it doesn't yet take into account ITDs.
  • Type: boolean
  • Since: 1.3
  • Required: No

Xjoinpoints:

supply a comma separated list of new joinpoints that can be identified by pointcuts. Values are: arrayconstruction, synchronization
  • Type: java.lang.String
  • Required: No

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.
  • Type: java.lang.String
  • Required: No

Xlintfile:

Specify properties file to set levels for specific crosscutting messages. PropertyFile is a path to a Java .properties file that takes the same property names and values as org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, which it also overrides.
  • Type: java.io.File
  • Required: No

XnoInline:

(Experimental) do not inline around advice
  • Type: boolean
  • Required: No

XnotReweavable:

(Experimental) Create class files that can't be subsequently rewoven by AspectJ.
  • Type: boolean
  • Required: No

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.
  • Type: boolean
  • Required: No

XserializableAspects:

(Experimental) Normally it is an error to declare aspects Serializable. This option removes that restriction.
  • Type: boolean
  • Required: No

Xset:

Allows the caller to provide additional arguments in a Map format. For example:
<configuration>
  <Xset>
    <overWeaving>true</overWeaving>
    <avoidFinal>false</avoidFinal>
  </Xset>
</configuration>
  • Type: java.util.Map
  • Since: 1.5
  • Required: No

XterminateAfterCompilation:

Causes compiler to terminate before weaving
  • Type: boolean
  • Required: No

ajdtBuildDefFile:

Where to find the ajdt build definition file. If set this will override the use of project sourcedirs.
  • Type: java.lang.String
  • Required: No

argumentFileName:

The filename holding AJC build arguments. The file will be placed in the project build output directory, and will contain all the arguments passed to the AJC compiler in the last run, and also all the files included in the AJC build. Sample content shown below to illustrate typical content within the builddef.lst file:
    
-1.6
-encoding
UTF-8
-classpath
/Users/lj/Development/Projects/Nazgul/nazgul_tools/validation/validation-api/target/nazgul-tools-validation-api-2.0.10-SNAPSHOT.jar:/Users/lj/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:/Users/lj/.m2/repository/org/aspectj/aspectjrt/1.7.3/aspectjrt-1.7.3.jar:/Users/lj/.m2/repository/junit/junit/4.11/junit-4.11.jar:/Users/lj/.m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar:/Users/lj/.m2/repository/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar:/Users/lj/Development/Projects/Nazgul/nazgul_tools/validation/validation-aspect/target/classes
-d
/Users/lj/Development/Projects/Nazgul/nazgul_tools/validation/validation-aspect/target/classes
/Users/lj/Development/Projects/Nazgul/nazgul_tools/validation/validation-aspect/src/main/java/se/jguru/nazgul/tools/validation/aspect/ValidationAspect.java
    
  • Type: java.lang.String
  • Required: No
  • Default: builddef.lst

aspectDirectory:

The source directory for the aspects.
  • Type: java.lang.String
  • Required: No
  • Default: src/main/aspect

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
  • Type: org.codehaus.mojo.aspectj.Module[]
  • Required: No

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.
  • Type: java.lang.String
  • Required: No

complianceLevel:

Specify compiler compliance setting. Defaults to 1.4, with permitted values ("1.3", "1.4", "1.5", "1.6" and "1.7").
  • Type: java.lang.String
  • Required: No
  • Default: 1.4

crossrefs:

generate .ajsym file into the output directory
  • Type: boolean
  • Required: No

deprecation:

Toggle warningmessages on deprecations
  • Type: boolean
  • Required: No

emacssym:

Generate .ajesym symbol files for emacs support.
  • Type: boolean
  • Required: No

encoding:

Specify default source encoding format.
  • Type: java.lang.String
  • Required: No
  • User Property: project.build.sourceEncoding

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 specified by the ajdtDefFile property are included.
  • Type: java.lang.String[]
  • Required: No

forceAjcCompile:

Forces re-compilation, regardless of whether the compiler arguments or the sources have changed.
  • Type: boolean
  • Required: No
  • Default: false

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 specified by the ajdtDefFile property are included.
  • Type: java.lang.String[]
  • Required: No

noImportError:

Emit no errors for unresolved imports;
  • Type: boolean
  • Required: No

outxml:

Generate aop.xml file for load-time weaving with default name (/META-INF/aop.xml).
  • Type: boolean
  • Required: No

outxmlfile:

Generate aop.xml file for load-time weaving with custom name.
  • Type: java.lang.String
  • Required: No

preserveAllLocals:

Preserve all local variables during code generation (to facilitate debugging).
  • Type: boolean
  • Required: No

proceedOnError:

Keep compiling after error, dumping class files with problem methods
  • Type: boolean
  • Required: No

referenceInfo:

Compute reference information.
  • Type: boolean
  • Required: No

repeat:

Repeat compilation process N times (typically to do performance analysis).
  • Type: int
  • Required: No

showWeaveInfo:

Emit messages about weaving
  • Type: boolean
  • Required: No

skip:

Skip plugin execution.
  • Type: boolean
  • Required: No
  • User Property: aspectj.skip
  • Default: false

source:

Toggle assertions (1.3, 1.4, 1.5, 1.6 or 1.7 - 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 or higher, Java 5 language features are permitted. With --source 1.7 or higher Java 7 features are supported.
  • Type: java.lang.String
  • Required: No
  • Default: ${mojo.java.target}

sources:

Set the java source folders to use, specifying the includes and excludes.

If you don't specify this parameter, all java sources of the current project fill be used. If you specify this parameter as an empty tag (i.e. <sources/>), all source folders will be ignored. Otherwise specify the source folder(s) to use.

  • Type: org.codehaus.plexus.util.Scanner[]
  • Since: 1.4
  • Required: No

target:

Specify classfile target setting (1.1 to 1.7) default is 1.2
  • Type: java.lang.String
  • Required: No
  • Default: ${project.build.java.target}

testAspectDirectory:

The source directory for the test aspects.
  • Type: java.lang.String
  • Required: No
  • Default: src/test/aspect

verbose:

Emit messages about accessed/processed compilation units
  • Type: boolean
  • Required: No

warn:

Emit warnings for any instances of the comma-delimited list of questionable code. Supported values are shown in the list below, with their respective explanations - as copied directly from the AJC reference.
constructorName
method with constructor name
packageDefaultMethod
attempt to override package-default method
deprecation
usage of deprecated type or member
maskedCatchBlocks
hidden catch block
unusedLocals
local variable never read
unusedArguments
method argument never read
unusedImports
import statement not used by code in file
none
suppress all compiler warnings
  • Type: java.lang.String
  • Required: No

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)).
  • Type: org.codehaus.mojo.aspectj.Module[]
  • Required: No

weaveDirectories:

List of of directories with .class files to weave (into target directory). Corresponds to ajc -inpath option.
  • Type: java.lang.String[]
  • Since: 1.4
  • Required: No

xmlConfigured:

Parameter which indicates an XML file containing AspectJ weaving instructions. Assigning this plugin parameter adds the -xmlConfigured option to ajc.
  • Type: java.io.File
  • Required: No