Fork me on GitHub

aspectj:test-compile

Full name:

org.codehaus.mojo:aspectj-maven-plugin:1.15.0:test-compile

Description:

Weaves all test classes. AspectJ Compiler Plugin.

Attributes:

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

Optional Parameters

Name Type Since Description
<additionalCompilerArgs> List<String> 1.13 Sets additional compiler arguments, e.g.
<compilerArgs>
  <arg>-Xmaxerrs=1000</arg>
  <arg>-Xlint</arg>
  <arg>-J-Duser.language=en_us</arg> 
</compilerArgs>
This option can be used in case you want to use AJC options not (yet) supported by this plugin.

Caveat: Be careful when using this option and select the additional compiler arguments wisely, because behaviour is undefined if you add arguments which have already been added by the plugin using regular parameters or their default values. The resulting compiler command line will in that case contain duplicate arguments, which might be illegal depending on the specific argument. Do not expect to be able to manually override existing arguments using this option or to replace whole argument lists.


<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
/my/library/lib.jar:/somewhere/aspectjrt.jar:/my/project/target/classes
-d
/my/project/target/classes
/my/project/src/main/java/org/acme/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 (same as setting 'source' and 'target' to the same level). Permitted values: 1.3, 1.4, 1.5, 5, 5.0, 1.6, 6, 6.0, 1.7, 7, 7.0, 1.8, 8, 8.0, 1.9, 9, 9.0, 10, 10.0, 11, 11.0, 12, 12.0, 13, 13.0, 14, 14.0, 15, 15.0, 16, 16.0, 17, 17.0
See also: AjcHelper.ACCEPTED_COMPLIANCE_LEVEL_VALUES
Default value is: 1.4.
<crossrefs> boolean - generate .ajsym file into the output directory
<deprecation> boolean - Toggle warning messages 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.
<generatedTestSourcesDirectory> File - The directory for sources generated by annotation processing.
Default value is: ${project.build.directory}/generated-test-sources/aspectj-maven-plugin.
<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.
<parameters> boolean - Set the compiler "parameters" argument.
<preserveAllLocals> boolean - Preserve all local variables during code generation (to facilitate debugging).
<proc> String - Set the compiler "proc" argument. Aspectj supports Annotation processing since 1.8.2, it can been disabled by proc:none.
See also: AspectJ 1.8.2 Release notes, Annotation Processing
<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 - Specify source code language level (1.3 to 1.9, 10 to 17). See 'complianceLevel' for details.
See also: AjcHelper.ACCEPTED_COMPLIANCE_LEVEL_VALUES
Default value is: ${mojo.java.target}.
<target> String - Specify bytecode target setting (1.3 to 1.9, 10 to 17). See 'complianceLevel' for details.
See also: AjcHelper.ACCEPTED_COMPLIANCE_LEVEL_VALUES
Default value is: ${project.build.java.target}.
<testAspectDirectory> String - The source directory for the test aspects.
Default value is: src/test/aspect.
<testSources> Scanner[] 1.4

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

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


See also: org.codehaus.plexus.util.DirectoryScanner
<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

See also: Eclipse AJC reference
<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.
<weaveMainSourceFolder> boolean - Flag to indicate if the main source dirs should be a part of the compile process. Note! This will make all classes in main source dir appear in the test output dir also, potentially overwriting test resources.
Default value is: false.
<weaveWithAspectsInMainSourceFolder> boolean - Flag to indicate if aspects in the the main source dirs should be a part of the compile process
Default value is: true.
<XaddSerialVersionUID> boolean - Causes the compiler to calculate and add the SerialVersionUID field to any type implementing java.io.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)
Default value is: 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.
<xmlConfigured> File - Parameter which indicates an XML file containing AspectJ weaving instructions. Assigning this plugin parameter adds the -xmlConfigured option to ajc.
See also: http://www.eclipse.org/aspectj/doc/next/devguide/ajc-ref.html
<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 java.io.Serializable. This option removes that restriction.
<Xset> Map<String,String> 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

Parameter Details

<additionalCompilerArgs>

Sets additional compiler arguments, e.g.
<compilerArgs>
  <arg>-Xmaxerrs=1000</arg>
  <arg>-Xlint</arg>
  <arg>-J-Duser.language=en_us</arg> 
</compilerArgs>
This option can be used in case you want to use AJC options not (yet) supported by this plugin.

Caveat: Be careful when using this option and select the additional compiler arguments wisely, because behaviour is undefined if you add arguments which have already been added by the plugin using regular parameters or their default values. The resulting compiler command line will in that case contain duplicate arguments, which might be illegal depending on the specific argument. Do not expect to be able to manually override existing arguments using this option or to replace whole argument lists.

  • Type: java.util.List<java.lang.String>
  • Since: 1.13
  • 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
/my/library/lib.jar:/somewhere/aspectjrt.jar:/my/project/target/classes
-d
/my/project/target/classes
/my/project/src/main/java/org/acme/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 (same as setting 'source' and 'target' to the same level). Permitted values: 1.3, 1.4, 1.5, 5, 5.0, 1.6, 6, 6.0, 1.7, 7, 7.0, 1.8, 8, 8.0, 1.9, 9, 9.0, 10, 10.0, 11, 11.0, 12, 12.0, 13, 13.0, 14, 14.0, 15, 15.0, 16, 16.0, 17, 17.0
See also: AjcHelper.ACCEPTED_COMPLIANCE_LEVEL_VALUES
  • Type: java.lang.String
  • Required: No
  • Default: 1.4

<crossrefs>

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

<deprecation>

Toggle warning messages 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

<generatedTestSourcesDirectory>

The directory for sources generated by annotation processing.
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/generated-test-sources/aspectj-maven-plugin

<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

<parameters>

Set the compiler "parameters" argument.
  • Type: boolean
  • Required: No

<preserveAllLocals>

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

<proc>

Set the compiler "proc" argument. Aspectj supports Annotation processing since 1.8.2, it can been disabled by proc:none.
See also: AspectJ 1.8.2 Release notes, Annotation Processing
  • Type: java.lang.String
  • 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>

Specify source code language level (1.3 to 1.9, 10 to 17). See 'complianceLevel' for details.
See also: AjcHelper.ACCEPTED_COMPLIANCE_LEVEL_VALUES
  • Type: java.lang.String
  • Required: No
  • Default: ${mojo.java.target}

<target>

Specify bytecode target setting (1.3 to 1.9, 10 to 17). See 'complianceLevel' for details.
See also: AjcHelper.ACCEPTED_COMPLIANCE_LEVEL_VALUES
  • 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

<testSources>

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

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


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

<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

See also: Eclipse AJC reference
  • 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

<weaveMainSourceFolder>

Flag to indicate if the main source dirs should be a part of the compile process. Note! This will make all classes in main source dir appear in the test output dir also, potentially overwriting test resources.
  • Type: boolean
  • Required: No
  • Default: false

<weaveWithAspectsInMainSourceFolder>

Flag to indicate if aspects in the the main source dirs should be a part of the compile process
  • Type: boolean
  • Required: No
  • Default: true

<XaddSerialVersionUID>

Causes the compiler to calculate and add the SerialVersionUID field to any type implementing java.io.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
  • Default: 1.5

<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

<xmlConfigured>

Parameter which indicates an XML file containing AspectJ weaving instructions. Assigning this plugin parameter adds the -xmlConfigured option to ajc.
See also: http://www.eclipse.org/aspectj/doc/next/devguide/ajc-ref.html
  • 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 java.io.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<java.lang.String, java.lang.String>
  • Since: 1.5
  • Required: No

<XterminateAfterCompilation>

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