I want to log my tests through AOP. I have class AspectLogger where I have defined pointcut and advices. When I run aspectj:test-compile, in output I see that advices were added to tests. Like
[INFO] Join point 'method-execution(void Back_end_task.APITest.test())' in Type 'Back_end_task.APITest' (APITest.java:22) advised by before advice from 'AspectLogger' (AspectLogger.java:26)
But when I run mvn clean test
in output I see errors like this:
java.lang.NoSuchMethodError: AspectLogger.aspectOf()LAspectLogger;
at Back_end_task.APITest.test(APITest.java:23)
By searching of this problem, I have found that I should add my project as a dependency to <aspectLibraries>
bloc of aspectj-maven-plugin, and add dependency of my project to <dependencies>
bloc of pom.xml. But the problem in this:
[FATAL] 'dependencies.dependency MyTraining:project:1.0-SNAPSHOT' for MyTraining:project:1.0-SNAPSHOT is referencing itself
This is link to my project
Please give me advice. What I missed? What wrong I'm doing? I want to learn how to use aspects.