I use maven-aspectj-plugin in a multi modules project using maven as a dependency tool. A simple demo project, you could find here demo-project.
At my real project, for the compatibiliy with lombok, I use an unusually dependency graph of modules;
starter ---> ajc ----> my business modules.
The starter is the program entrancem. The aspects are in ajc module which has only aspects. All the java class which will be weaved into are in business modules. Using this dependency, so I could use lombok in my business modules, and the weaving process appears in the compile of ajc module. At that time, the business module has been compiled to byte code with lombok. Of course, I need use the weaveDependency style.
It has been working well for a long time. But today I begin my another project. The proceeding point was not enter into. The most interesting part is the aspect work well when i use idea to run the application. But I deploy it with jars. The program do not enter aspect. I try to reproduce the bug using a simple project demo. But the aspect works well unexpectedly.
So I dig into target directory of ajc module. I found the class files which are same with the weaving goal java class in my bussiness modules. Interesting, it answer my another question. The weaving dependency feature didn't edit the target jar. How it works? Now, I know that, it add a new class with aspect in aspects directory. Jvm may choose one of java classes.
I think my questions should comes from this random procedure.
And the finally questions: If my guess is right. The weave dependency featue is that copy the original java class and edit it, then put it in a another directory or another jar, but shares same package name and class name with the orignal java class. But it will bring another problem, there are two java class file with same package name and same class name. The class loading will perform different in different OS thanks to file inode and it dependend on the os file system.
Are there any mechanisms to prevent class loader random load one java class file of these two.
I have give my guess in the details. Want to hear explain from plugin author about this question