Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ compile-time weaving in Maven not working

Hello,

I was using AspectJ LTW in my Spring application to inject
dependencies in objects never created outside the Spring bean-factory.
I have decided to switch to CTW, but I can't seem to get it working
correctly in Eclipse or Maven. For Maven, I generally followed this
guide: http://www.chrissearle.org/blog/technical/spring_aspects_configurable_and_compile_time_weaving_using_maven

I added aspectjrt-1.6.4 and spring-aspects-2.5.4 as dependencies, plus:

	<build>
		<pluginManagement>
			<plugins>
	            <plugin>
	                <groupId>org.codehaus.mojo</groupId>
	                <artifactId>aspectj-maven-plugin</artifactId>
	                <version>1.1</version>
	                <configuration>
	                	<complianceLevel>1.6</complianceLevel>
	                	<verbose>true</verbose>	
	                    <aspectLibraries>
	                        <aspectLibrary>
							    <groupId>org.springframework</groupId>
							    <artifactId>spring-aspects</artifactId>
	                        </aspectLibrary>
	                    </aspectLibraries>
	                    <showWeaveInfo>true</showWeaveInfo>
	                </configuration>
	                <executions>
	                    <execution>
	                        <goals>
	                            <goal>compile</goal>
	                        </goals>
	                    </execution>
	               </executions>
	           </plugin>

Unfortunately, my dependencies never get injected when I boot up. I
also didn't notice any AspectJ-specific messages during the Maven
compile.

In Eclipse, I use the AspectJ plugin. I right-clicked on my existing
project and selected something like "Add AspectJ Capability" or
whatever it was. It then appeared with the little A on the icon. From
this point I tried building and running the projects as normal, and no
dependencies were injected. I then tried adding spring-aspects.jar to
my Aspects Path, but that didn't help either.

Any suggestions would be very welcome.

Rob


Back to the top