Re: [aspectwerkz-user] Eclipse integration using annotations

Alexandre Vasseur <[email protected]> Wed, 20 Jul 2005 11:35:56 +0200
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
Are you using the AspectWerkz Eclipse plugin with the AW nature turned on ?
if so, yes you need an aop.xml file as explained in
http://docs.codehaus.org/display/AW/Eclipse+plugin

"For weaving to occur, the system needs to know which class is an
aspect. Just as usual, this is done
thru the META-INF/aop.xml descriptor.
There is no requirements for this part. You just need to have one or
more META-INF/aop.xml file in your classpath - be it the project
itself or within a dependency jar file that may contains bundled
aspects.
A common practice is to have the project aop.xml file in the
<project>/src/META-INF/aop.xml location."

Alex

On 7/20/05, Vinicius Carvalho <[email protected]> wrote:
> Hello there! I've just started with AspectWerkz (I have some
> background with AspectJ and AJDT and Spring AOP).
> 
> Well, so I built the simplest example on eclipse 3.1 final:
> 
> Here it is:
> 
> package com.cs.aspects;
> 
> public class HelloWorld {
> 
>         /**
>          * @param args
>          */
>         public static void main(String[] args) {
>                 HelloWorld helloWorld = new HelloWorld();
>                 helloWorld.greet();
>         }
> 
>         public void greet(){
>                 System.out.println("Hello World");
>         }
> 
> }
> 
> package com.cs.aspects;
> 
> import org.codehaus.aspectwerkz.annotation.Before;
> import org.codehaus.aspectwerkz.definition.Pointcut;
> import org.codehaus.aspectwerkz.annotation.Expression;
> import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
> 
> public class HelloAspect {
>         @Expression("* com.cs.aspects.HelloWorld.greet(...)")
>         Pointcut myPointcut;
>         @Before("myPointcut")
>         public void beforeGreet(JoinPoint joinPoint) throws Throwable{
>                 System.out.println(joinPoint.getCallee().getClass().getName());
>         }
> 
> }
> 
> Well eclipse is not marking the method that has the joinpoint. I was
> wondering if even if I'm using annotations, should I need an aop.xml
> file? I tried with one and also no success. What am I missing here?
> 
> Regards
>