To resolve the aspectjweaver dependency, add this repository:
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
This will give you access to version 1.8.0.M1 of aspectjrt, aspectjweaver and aspectjtools.
However, version 1.6 of the aspectj-maven-plugin does not support Java 8.
Yet spring-aspects-4.0.0 has a dependency on aspectjweaver 1.8.0.M1 for Java 8 support.
If you're using Spring 3.2.6 and Java 7, this aspectj-maven-plugin config works:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<complianceLevel>1.7</complianceLevel>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
<showWeaveInfo>true</showWeaveInfo>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
You might be able to insert an exclusion on aspectjweaver 1.8.0.M1 within the spring-aspects 4.0.0 dependency. And that might allow you to use Spring 4 with Java 7 and all of the 1.7.4 aspectj* dependencies.
In an effort to apply compile-time weaving (CTW) in a Spring 4/Java 8 project, I came across the following posts:
Maven, Scala, Spring, AspectJ
https://weblogs.java.net/blog/fabriziogiudici/archive/2011/07/19/making-lombok-aspectj-and-maven-co-exist
And here is my solution: https://github.com/javawerks/homeschool/blob/master/pom.xml
It works! Note that this solution uses version 1.8.0.M1 of the 3 aspectj* amigos, which can be found here: http://repo.spring.io/milestone/org/aspectj/
Warning: If your local maven repository does not yet have the maven-antrun-plugin dependencies, you will get " can't find * dependency in maven central " errors. To resolve this issue, copy the dependencies to your main dependencies element; mvn clean compile; remove copied dependencies; and maven-antrun-plugin should find the aspectj* dependencies. Then execute 'mvn clean install' and verify the ajc logging.
Finally,in Intellij you will see a ' cannot resolve symbol ' error for this iajc attribute:
aspectPath="${org.springframework:spring-aspects:jar}"
No worries, it works as expected. It's a maven-antrun-plugin naming convention.
Someday, the aspectj-maven-plugin will be updated to support Java 8, and then we can return to normalcy. That said, the showWeaveInfo="true" logging is much nicer.
Hope this helps. Like so many before me, it took a lot of beer to figure this one out.;)