I have reported this issue on stackoverflow and in the aspectj mailing lists.
Basically, when I put aspects in my test source folder (src/test/java) Eclipse (with the m2e compiler) will weave the aspect into classes from the main source folder (src/main/java). See https://github.com/benze/aspectj-maven-plugin-defect-example.
The goal is to have an aspect from my src/test/java path woven into my classes from src/main/java but output only in my target/test-classes. The reasoning behind this is that the aspect is only used for junit testing and not for normal code compilation/use.
When I build from the command line, everything works properly. The "compile" goal compiles & weaves all my src/main/java files to the target/classes output directory and the "test-compile" compiles & weaves all my src/test/java files into target/test-classes.
However, when I build from within Eclipse, my Aspects in src/test/java are woven into classes in target/classes as well (see target/classes/com/test/ServiceImpl.class. With the decompiler, I can see the MangleAspect has been woven in. Additionally, only the files from src/test/java are output into target/test-classes while the pom instructs ajc to do otherwise (weave all class files from target/classes into target/test-classes).
I noticed, however, if I disable the m2e connector and just use lifecycle mapping within my pom directly that instructs the aspectj plugin to execute on compile/test-compile goals, my output seems to be as I would expect. Can this be an m2e connector issue? I'm not entirely clear on how this connector works, or how it is injected into the m2e maven compile process.
I have reported this issue on stackoverflow and in the aspectj mailing lists.
Basically, when I put aspects in my test source folder (src/test/java) Eclipse (with the m2e compiler) will weave the aspect into classes from the main source folder (src/main/java). See https://github.com/benze/aspectj-maven-plugin-defect-example.
The goal is to have an aspect from my src/test/java path woven into my classes from src/main/java but output only in my target/test-classes. The reasoning behind this is that the aspect is only used for junit testing and not for normal code compilation/use.
When I build from the command line, everything works properly. The "compile" goal compiles & weaves all my src/main/java files to the target/classes output directory and the "test-compile" compiles & weaves all my src/test/java files into target/test-classes.
However, when I build from within Eclipse, my Aspects in src/test/java are woven into classes in target/classes as well (see target/classes/com/test/ServiceImpl.class. With the decompiler, I can see the MangleAspect has been woven in. Additionally, only the files from src/test/java are output into target/test-classes while the pom instructs ajc to do otherwise (weave all class files from target/classes into target/test-classes).
I noticed, however, if I disable the m2e connector and just use lifecycle mapping within my pom directly that instructs the aspectj plugin to execute on compile/test-compile goals, my output seems to be as I would expect. Can this be an m2e connector issue? I'm not entirely clear on how this connector works, or how it is injected into the m2e maven compile process.