Hi,
I'm new to AOP. I'm trying to create a simple aspect and include it in a war deployed in JBossAS, built with maven.
I've got it working with jboss-aop.xml descriptor but I can't figure out how to do this with annotations.
My pom.xml includes:
<plugin> <groupId>org.jboss.maven.plugins</groupId> <artifactId>maven-jbossaop-plugin</artifactId> <version>2.1.3.GA</version> <executions> <execution> <id>compile</id> <configuration> <suppress>false</suppress> <includeProjectDependency>true</includeProjectDependency> <aoppaths><aoppath>${basedir}/src/main/resources/META-INF/jboss-aop.xml</aoppath></aoppaths> <includes><include>com/blah/Blah.class</include></includes> </configuration> <goals><goal>compile</goal></goals> </execution> </executions> </plugin>
And my jboss-aop.xml :
<aop xmlns="urn:jboss:aop-beans:1.0"> <aspect scope="PER_VM"/>
<bind pointcut="execution(* com.blah.Blah->*(..))"> <advice name="trace" aspect="com.blah.MyAspect"/> </bind> </aop>
This way it works, I get all the classes weaved at compile-time.
But then I remove jboss-aop.xml and inculde annotations in MysAspect.java:
@Aspect (scope = Scope.PER_VM) public class MyAspect{
@Bind (pointcut="execution(* com.blah.Blah->*(..))") public Object trace(Invocation invocation) throws Throwable {
....
As I see it, maven plugin just ignores any annotation processing.
[INFO] [jbossaop:compile {execution: compile}]
[INFO] [no comp needed] ...
Is there any way to weave classes with annotations with maven-jbossaop-plugin ?