Usage
This plugin weaves AspectJ aspects into your classes using the AspectJ compiler ("ajc"). There are typically two ways to package and use aspects in your Maven reactors; either as a standalone project where aspects and code are defined within the same Maven project - or as part of a multi-module Maven reactor where one/some project(s) contains aspects and other projects within the Maven reactor contain code using the aspects ("woven by the aspects").
Below follows a standard single-project usage example.
<project>
...
<dependencies>
...
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.7</version>
</dependency>
...
</dependencies>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.15.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal> <!-- use this goal to weave all your main classes -->
<goal>test-compile</goal> <!-- use this goal to weave all your test classes -->
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
<build>
...
</project>Upgrading AspectJ
The frequency of releases of this plugin is lower than of AspectJ. If you want to use a different version of AspectJ than 1.9.7, you also need to upgrade the aspectjtools within the plugin.
<project>
...
<properties>
<aspectj.version>1.7.n</aspectj.version> <!-- specify your version -->
</properties>
<dependencies>
...
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
...
</dependencies>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.15.0</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
<build>
...
</project>

