Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To resolve the aspectjweaver dependency, add this repository:</p> <pre><code>&lt;repository&gt; &lt;id&gt;spring-milestones&lt;/id&gt; &lt;url&gt;http://repo.spring.io/milestone&lt;/url&gt; &lt;snapshots&gt; &lt;enabled&gt;true&lt;/enabled&gt; &lt;/snapshots&gt; &lt;/repository&gt; </code></pre> <p>This will give you access to version 1.8.0.M1 of aspectjrt, aspectjweaver and aspectjtools.</p> <p>However, version 1.6 of the aspectj-maven-plugin does not support Java 8.</p> <p>Yet spring-aspects-4.0.0 has a dependency on aspectjweaver 1.8.0.M1 for Java 8 support.</p> <p>If you're using Spring 3.2.6 and Java 7, this aspectj-maven-plugin config works:</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.6&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.7&lt;/source&gt; &lt;target&gt;1.7&lt;/target&gt; &lt;complianceLevel&gt;1.7&lt;/complianceLevel&gt; &lt;aspectLibraries&gt; &lt;aspectLibrary&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt; &lt;/aspectLibrary&gt; &lt;/aspectLibraries&gt; &lt;showWeaveInfo&gt;true&lt;/showWeaveInfo&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;compile&lt;/goal&gt; &lt;goal&gt;test-compile&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>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.</p> <p>In an effort to apply compile-time weaving (CTW) in a Spring 4/Java 8 project, I came across the following posts:</p> <ol> <li><p><a href="https://stackoverflow.com/questions/6102518/maven-scala-spring-aspectj">Maven, Scala, Spring, AspectJ</a></p></li> <li><p><a href="https://weblogs.java.net/blog/fabriziogiudici/archive/2011/07/19/making-lombok-aspectj-and-maven-co-exist" rel="nofollow noreferrer">https://weblogs.java.net/blog/fabriziogiudici/archive/2011/07/19/making-lombok-aspectj-and-maven-co-exist</a></p></li> </ol> <p>And here is my solution: <a href="https://github.com/javawerks/homeschool/blob/master/pom.xml" rel="nofollow noreferrer">https://github.com/javawerks/homeschool/blob/master/pom.xml</a></p> <p>It works! Note that this solution uses version 1.8.0.M1 of the 3 aspectj* amigos, which can be found here: <a href="http://repo.spring.io/milestone/org/aspectj/" rel="nofollow noreferrer">http://repo.spring.io/milestone/org/aspectj/</a></p> <p>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.</p> <p>Finally,in Intellij you will see a ' cannot resolve symbol ' error for this iajc attribute:</p> <pre><code>aspectPath="${org.springframework:spring-aspects:jar}" </code></pre> <p>No worries, it works as expected. It's a maven-antrun-plugin naming convention.</p> <p>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.</p> <p>Hope this helps. Like so many before me, it took a lot of beer to figure this one out.;)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload