aspectj: How to weave aspects from a library into

2019-06-11 14:11发布

问题:

I have a library with some classes and a few aspects in it. Say AspectedLib.jar is the file that contains such definitions (created in eclipse, with "export jar file with aspectj support"). If I import the AspectedLib.jar file, and even use some of the classes defined in it, it works, but none of the joinpoints is triggered, i.e., the aspects are not executed.

How can I make this work? Ideally, how can I set this up in eclipse*?

* Version: Juno Service Release 2; Build id: 20130225-0426

回答1:

You need to add the jar to your aspect path. In your Eclipse project preferences, go to AspectJ build -> Aspect Path and add the jar.