Maven AspectJ plugin dIon Gillard Vincent Massol Carlos Sanchez

AspectJ plugin for Maven. It offers the ability to weave aspects on the classes generated and dependency libraries. This also includes the ability to add dependencies on libraries with aspects.

For more information on the functionality provided by this plugin, please see the Goals document.

For more information on how to customise the functionality provided by this plugin, please see the properties document.

To install or update the plugin do the following:
maven plugin:download -DgroupId=maven -DartifactId=maven-aspectj-plugin -Dversion=<version>

You must add the property aspectSourceDirectory in your project.xml

src/aspectj ]]>

You must tell Maven what aspects you want to weave project classes with in addition to the source aspects in your project. This is achieved by specifying meta-information in the POM, using the aspectj.weaveWith property

groupid jarid jarversion true ]]>

You must tell Maven what libraries you want to weave with project aspects or aspect libraries. This is achieved by specifying meta-information in the POM, using the aspectj.weaveInto property

groupid jarid jarversion true ]]>

The jar contents, with classes weaved, are extracted to maven.build.dest.

If you are creating a deployable file like a war you need to add the aspectjrt library to your dependencies so it gets included in the file. You shouldn't need to add it for other operations.

aspectj aspectjrt 1.2 http://www.eclipse.org/aspectj true ]]>

If you want to call the aspectj goal every time you compile add the following to your maven.xml file.

]]>

If you don't want to weave test classes use the following code instead.

]]>
3 examples example-with-aspects 1.0 company-jars jar-one 1.0 true company-aspects example-aspects 1.0 true company-jars jar-two 1.0 true aspectj aspectjrt 1.2 http://www.eclipse.org/aspectj true src/java src/aspectj ]]>