问题描述:

Hi My problem is pretty much same as AspectJ Plugin Aspect Config with Maven using external Jar for Aspect

Here is my pom.xml

<build>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-war-plugin</artifactId>

<!-- <configuration> <webXml>target/web.xml</webXml> </configuration> -->

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.6</source>

<target>1.6</target>

</configuration>

</plugin>

<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>aspectj-maven-plugin</artifactId>

<dependencies>

<!-- NB: You must use Maven 2.0.9 or above or these are ignored (see

MNG-2972) -->

<dependency>

<groupId>org.aspectj</groupId>

<artifactId>aspectjrt</artifactId>

<version>${aspectj.version}</version>

</dependency>

<dependency>

<groupId>org.aspectj</groupId>

<artifactId>aspectjtools</artifactId>

<version>${aspectj.version}</version>

</dependency>

</dependencies>

<executions>

<execution>

<goals>

<goal>compile</goal>

<goal>test-compile</goal>

</goals>

<phase>process-sources</phase>

</execution>

</executions>

<configuration>

<outxml>true</outxml>

<aspectLibraries>

<aspectLibrary>

<groupId>org.springframework</groupId>

<artifactId>spring-aspects</artifactId>

</aspectLibrary>

</aspectLibraries>

<weaveDependencies>

<weaveDependency>

<groupId>${project.groupId}</groupId>

<artifactId>core</artifactId>

</weaveDependency>

<weaveDependency>

<groupId>${project.groupId}</groupId>

<artifactId>core-client</artifactId>

</weaveDependency>

</weaveDependencies>

<source>1.6</source>

<target>1.6</target>

</configuration>

</plugin>

</build>

I have my aop.xml in META-INF directory as follows:

<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">

<aspectj>

<!--

We only want to weave in the log4j TimingAspect into the @Profiled classes.

Note that Perf4J provides TimingAspects for the most popular Java logging

frameworks and facades: log4j, java.util.logging, Apache Commons Logging

and SLF4J. The TimingAspect you specify here will depend on which logging

framework you wish to use in your code.

-->

<aspects>

<aspect name="org.perf4j.log4j.aop.TimingAspect"/>

<!-- if SLF4J/logback use org.perf4j.slf4j.aop.TimingAspect instead -->

</aspects>

<weaver options="-verbose -showWeaveInfo">

<!--

Here is where we specify the classes to be woven. You can specify package

names like com.company.project.*

-->

<include within="com.xyz.store.security.*"/>

</weaver>

</aspectj>

What I want to do ultimately is this:

http://perf4j.codehaus.org/devguide.html#Using_the_AspectJ_Compiler_to_Integrate_Timing_Aspects_at_Compile_Time

相关阅读:
Top