I'm trying to apply a cross cutting concern which is logging with AspectJ and a test framework called Katalon which uses Groovy and Java. I found that the best weaving type appropriate here is load-time weaving which requires a META-INF folder and an Aop.xml. I tried to put my aop.xml in multiple places but I think aspectj is unable to find it. This is the structure of my project:
Here is my aop.xml file content:
<aspectj>
<aspects>
<aspect name="com.fd.common.aspectName"/>
<weaver options="-verbose -showWeaveInfo">
<include within="com.myapp.common.*"/>
</weaver>
</aspects>
</aspectj>
And here is my aspect :
@Aspect
public class test {
@org.aspectj.lang.annotation.Before("execution(* *.*(..))")
public void bef (JoinPoint jp) {
System.out.println(jp.getSignature());
System.out.println("Beforeeeeeeeeeeeeeeeeeeeee");
}
}
My first guess, not having seen your real project, is that you should move the weaver options out of the aspect declaration section like this:
<aspectj>
<aspects>
<aspect name="com.fd.common.aspectName"/>
</aspects>
<weaver options="-verbose -showWeaveInfo">
<include within="com.myapp.common.*"/>
</weaver>
</aspectj>
If this does not help, I need more information. I have never used Katalon before, so I need to inspect your exact project setup - of course not your full original project, if proprietary. But please prepare an MCVE reproducing the problem, publish it on GitHub and I can take a look for you. I need to see how you call java and what is logged to the console.
Update: There was a follow-up question about how to use system property org.aspectj.weaver.loadtime.configuration
in order to point to an alternative resource URL or file system path name. I answered the same question before here and have just updated it with some more detail.