I am using AspectJ for logging when tests execution only, so I use load time weaving. I pack Interceptor to a jar file to use with another Maven project. But with below config, aspectjweaver will weave methods of external libraries. I want it only weave my source code (include test) without specific config like <include within="hello.*"/>
, for generic using like dependency.
Sorry, my English is quite bad. Thanks so much !!!
In aop.xml of this jar file, it likes
<aspectj>
<aspects>
<aspect name="log.Interceptor"/>
<weaver options="-verbose -showWeaveInfo">
<include within="*"/>
</weaver>
</aspects>
</aspectj>
// Interceptor
pointcut traceMethods() : (execution(* *(..)) && !cflow(within(Interceptor)) && !within(*Test) && !within(Test*) && !within(*Tests) && !within(*TestCase));
before(): traceMethods(){
Method method = ((MethodSignature) thisJoinPointStaticPart.getSignature()).getMethod();
logDebug(method, LogPattern.METHOD_START);
}
after(): traceMethods(){
Method method = ((MethodSignature) thisJoinPointStaticPart.getSignature()).getMethod();
logDebug(method, LogPattern.METHOD_FINISH);
}`