Fork me on GitHub jcabi

23-Oct-2013 0.11.2

"Aspectj" Profile for AOP Weaving

The profile is activated automatically when you have a src/main/aspect directory in the project. Otherwise, you can activate it explicitly:

$ mvn clean install -Paspectj

The profile runs aspectj-maven-plugin plugin and adds these dependencies to the classpath:

Don't forget to add JSR-303 validator implementation to your classpath, as explained in jcabi-aspects.

Pay attention that these dependencies are there only when profile is activated. After the artifact installation the profile won't be activated and you should add runtime dependencies explicitly to the project:

<dependencies>
  <dependency>
    <groupId>com.jcabi</groupId>
    <artifactId>jcabi-aspects</artifactId>
  </dependency>
  <dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <scope>runtime</scope>
  </dependency>
  <dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <scope>runtime</scope>
  </dependency>
</dependencies>

This profile doesn't conflict with APT, because AspectJ weaving is happening outside of the main directory and its results are applied on top of APT-processed classes. The solution is borrowed from Sean Patrick Floyd.

Copyright © 2012-2013 jcabi.com, All Rights Reserved. Privacy Policy.

site is built by Apache Maven