2 Replies Latest reply on Jun 8, 2010 12:21 PM by sintetik7

    Maven plugin annotations parsing




      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:








      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"/>




      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 ?

        • 1. Re: Maven plugin annotations parsing

          Try using <aopClassPath/> pointing to the directory containing your annotated classes. Here is a snippet from the pom of the annotated-aspects example in the aop distribution



          • 2. Re: Maven plugin annotations parsing

            Thanks, exactly like I needed.