[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AJDT and m2e?

Hi,

I'm running into an odd problem with m2e and AJDT.  With Andy's help on the SpringSource STS forum, I think I have managed to isolate the problem a little better, but not sure if I am encountering a bug, or if there is something I am missing in my Eclipse configuration.

My original thread can be found at: http://forum.springsource.org/showthread.php?125470-How-to-enable-AspectJ-nature-in-a-Spring-project-with-annotated-and-aj-aspects

In a nutshell, I have a Maven based Spring project.  I'm using Eclispe 3.7 with the following m2e plugins
m2e: 1.0.100.20110804-1717 
maven for AJDT: 0.13.0.2011.07281640
maven for WTP: 0.14.0.20110928-2045

I have some Spring aspects defined with AspectJ annotations.  By themselves, they work fine.  I then added some .aj aspects and enabled AspectJ Capabilities on the project.  Suddenly my Spring aspects are instantiated twice in my junit tests - once by Spring, and once (I believe) by some CTW of the AJ compiler.  (Note that these are junits run within Eclipse).

If I use the -xmlConfigured flag on AJ project properties and specify my own aop.xml file with only my .aj aspect listed there the junits work fine.

I have tried added an <exclude> tag in my aspectj-maven-plugin, excluding the Spring aspects, but they are still run twice.

Is this a bug in m2e?  Or is there a problem with AJDT?  Or am I doing something wrong, or missing some configuration somewhere?

My pom has the following aj-related things

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>

<!-- Support for AspectJ Annotations -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${org.aspectj}</version>
</dependency>

<!-- AspectJ weaving -->                        
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${org.aspectj}</version>
</dependency>

...
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<outxml>true</outxml>
<source>1.6</source>
<target>1.6</target>
<weaveDependencies>
<weaveDependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</weaveDependency>
</weaveDependencies>
<!-- don't weave any of the Spring aspects with AJ --> 
<excludes>
<exclude>**/*Interceptor.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>


Thanks,

Eric