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 <[email protected]> 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
> [email protected]
> 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
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to