Reputation: 11455
I have a project which uses compile time weaving of aspects. this project depends on another project, which is a included as a jar. I want to weave a class in the jar file while compiling. How can i achieve this.
Thanks
Upvotes: 5
Views: 5715
Reputation: 2355
If you are using maven, you can use the aspectj-maven-plugin as well. It works well with eclipse (m2e).
In the plugin, just specify the groupId/artifactId of the dependent jar as well in the configuration/weaveDependencies/weaveDepedency.
See http://mojo.codehaus.org/aspectj-maven-plugin/weaveJars.html
Upvotes: 4
Reputation: 28757
This jar needs to be added to the inpath of the project being compiled. The result will be a new set of class files. These new class files are the woven ones and should be used at runtime instead of the original jar.
How to set the in path is dependent on how you compile your code:
-inpath
option. See here http://www.eclipse.org/aspectj/doc/released/devguide/ajc-ref.html.The tricky part is to remember to avoid using the original jars in the running application, but rather the woven jars.
Upvotes: 6