Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: [ajdt-dev] How to prevent AJDT from weaving some class?

I am not completely familiar with the semantics of the aop.xml file, but it seems that you are instructing the weaver to include your test case classes. At least this is what appears in the file you have attached. Wouldn't you want to *exclude* the test classes? Also, a perhaps more traditional approach would be to exclude all join points from the test classes explicitly in your pointcuts. While this approach is a bit more coupled than using an external XML metadata file, you could use abstract pointcuts to customize the weaving to particular systems. Hope that helps!

Raffi

On May 20, 2010, at 1:59 PM, Benyi Wang <bewang.tech@xxxxxxxxx> wrote:

It seems that AJDT tries to weave all classes in a project by default.

I attached files in a test project.

When I use "call" for pointcuts of interface Addable in MyAspect, AJDT tries to weave the interface calls of the mock object. Sometimes I don't want the advices in my unit test code, for example, advices from the log aspect.

How can I prevent AJDT from weaving junit test case classes?

I did a test in my Eclipse 3.5 with AJDT 2.0.2.

If I add aop.xml into project properties->AspectJ Builder->aop.xml Management, some wired things happens: all aspectj advice markers are gone. You need to clean the project first, otherwise you may see the markers are still there. if you clean the project "Project->clean...", only the files under src/main/java are compiled, src/test/java are not compiled.
remove aop.xml from aop.xml management, everything comes back.
What's wrong in my project? Is this AJDT bug?

Thanks.

Ben
<pom.xml>
<AjdtWeavingTest.java>
<MyAspect.java>
<Addable.java>
<AjdtWeaving.java>
<aop.xml>
_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ajdt-dev


Back to the top