Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with aspectj m2e connector 0.14 with aspects in test classes #6

Open
benze opened this issue Jun 22, 2015 · 0 comments
Open

Comments

@benze
Copy link

benze commented Jun 22, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant