Hi Andy, Thanks for the reply. Are you saying that there is no way in Eclipse to differentiate which are test classes and which are source classes?
I'm actually seeing a behaviour that I find troubling. If I compile my code from the command line, I get a [Xlint:adviceDidNotMatch] when ajc runs my test-classes. Consequently, my aspect is never woven into my class. But when I compile from within Eclipse, the aspect is woven in. I suspect that it has something to do with the classpath that maven is presenting to ajc; indeed when I enable debug information, I see that the /src/main/java classes are not on the path to ajc as they are during the regular compilation, and only the src/test/java classes are present. I don't know if this is a limitation of the ajc compiler, or if there is a way to tell it to additionally (re)compile / weave classes into the output folder only if they are affected. I see the '-inpath' argument to ajc, but will dump everything in the inpath to the output directory, or only the changed classes? Is there a way to tell it only to put the classes into the output directory if they are changed/modified? Thanks, Eric On Fri, Jun 19, 2015 at 12:19 PM, Andy Clement <andrew.clem...@gmail.com> wrote: > Are you simply hitting the problem that in Eclipse a project does not > support separate compilation of src/main and src/test trees. When you > import your project into eclipse those things get merged together, and all > built together. You could perhaps get around this by adjusting your > pointcuts in your aspect to only match the test code - not ideal I know. > > cheers, > Andy > > > On Jun 18, 2015, at 11:25 AM, Eric B <ebenza...@gmail.com> wrote: > > > > I posted a question on StackOverflow, but haven't received much traction > there, so I thought I would check with people on this list as well. > > > > I'm having trouble with Eclipse weaving aspects from my test folder into > my target/classes folder (as opposed to putting the woven classes into > target/test-classes) > > > > I've got a maven project in which I have @Aspect classes in my > src/test/java folder. If I build from command line, everything runs > properly. If however, I build from within Eclipse, the compiler weaves my > aspects into my target class files and puts them in target/classes. > > > > This obviously causes me troubles as the JVM tries to find the woven > Aspect and throws NoClassDefFoundError (since the actual aspect.class is > only in target/test-classes). > > > > Has anyone encountered this before? Is there a way to instruct > ajc/Eclipse/maven/m2e to put the woven class file into target/test-classes > and not target/classes when it is due to an aspect from the test folder? > > > > > > My pom defn shows the following for the ajc plugin: > > <plugin> > > <groupId>org.codehaus.mojo</groupId> > > <artifactId>aspectj-maven-plugin</artifactId> > > <version>1.2</version> > > <executions> > > <execution> > > <goals> > > <goal>compile</goal> > > <goal>test-compile</goal> > > </goals> > > <configuration> > > <outxml>true</outxml> > > <aspectLibraries> > > <aspectLibrary> > > <groupId>org.springframework</groupId> > > <artifactId>spring-aspects</artifactId> > > </aspectLibrary> > > </aspectLibraries> > > <source>7</source> > > <target>7</target> > > </configuration> > > </execution> > > </executions> > > <dependencies> > > <dependency> > > <groupId>org.aspectj</groupId> > > <artifactId>aspectjrt</artifactId> > > <version>1.7.0</version> > > <scope>compile</scope> > > </dependency> > > <dependency> > > <groupId>org.aspectj</groupId> > > <artifactId>aspectjtools</artifactId> > > <version>1.7.0</version> > > <scope>compile</scope> > > </dependency> > > </dependencies> > > <configuration> > > <outxml>true</outxml> > > <aspectLibraries> > > <aspectLibrary> > > <groupId>org.springframework</groupId> > > <artifactId>spring-aspects</artifactId> > > </aspectLibrary> > > </aspectLibraries> > > <source>7</source> > > <target>7</target> > > </configuration> > > </plugin> > > > > > > I've tried running maven 3.0.4 and 3.2.5, but no difference. > > > > Thanks, > > > > Eric > > > > > > > > > > _______________________________________________ > > aspectj-users mailing list > > aspectj-users@eclipse.org > > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/aspectj-users >
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/aspectj-users