July 17, 2009

AspectJ in Maven

« Spring AspectJ | Main | Performance Java - Perf4J »

In AspectJ you can either use build-time or load-time weaving. The load-time weaving needs performance at runtime and the memory footprint is affected. The build-time weaving consumes speed during compilation. To define aspects you can define AspectJ files with a special syntax or you use AspectJ annotations. If you want to enable AspectJ at the build time you can use the AspectJ Maven plugin. In this case the following fragment has to be added in the pom.xml file.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.1</version>
    <configuration>
        <complianceLevel>1.5</complianceLevel>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>test-compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Regards
Rafael

Technorati Tags:

Posted by rafael.sobek at 9:55 PM in Maven

 

[Trackback URL for this entry]

Your comment:

(not displayed)
 
 
 

Live Comment Preview:

 
 
test