Note that there are some explanatory texts on larger screens.

plurals
  1. POAspectJ not weaving on test-compile but weaves on compile. Therefore unit tests throw ClassNotFoundException when running with maven
    primarykey
    data
    text
    <p>All my junit tests have been passing in eclipse, but when run from the console they seem to throw ClassNotFoundException for the AJ class RiskLogAspect.aj I can verify that in eclipse this is correctly weaving and providing the required functionality. </p> <p>I've tried adding dependencies to my project to make sure there all correct. </p> <p>I started adding the aspectj-maven-plugin </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.3&lt;/version&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;phase&gt;process-sources&lt;/phase&gt; &lt;configuration&gt; &lt;showWeaveInfo&gt;true&lt;/showWeaveInfo&gt; &lt;encoding&gt;UTF8&lt;/encoding&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;aspects&gt; &lt;includes&gt; &lt;include&gt;com.idna.riskprofile.RiskLogAspect&lt;/include&gt; &lt;/includes&gt; &lt;/aspects&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>I then added the following dependencies</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;org.aspectj&lt;/groupId&gt; &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt; &lt;version&gt;1.6.7&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.aspectj&lt;/groupId&gt; &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt; &lt;version&gt;1.6.7&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>Any ideas what's going wrong ?</p> <p>I'm running maven 2.0.9 and also jdK 1.6 update 21</p> <p>After changing some of my configuration I've noticed in the console I get the follow " [Xlint:adviceDidNotMatch] " It seems like it is picking up my class but not applying the pointcut correctly.</p> <p>For the goal compile it finds the AJ file and applies the advice correctly, for the test-compile goal it says Xlint:adviceDidNotMatch and throws class not found exceptions for half the junit tests. From the console:</p> <pre><code>[INFO] [aspectj:compile {execution: default}] [INFO] Join point 'method-execution(java.lang.String com.idna.riskprofile.impl.RiskProfileEntryPointImpl.execute(com.idna.riskprofile.domain.RiskProfileRequest))' in Type 'com.idna.riskprofile.impl.RiskProfileEntryPointImpl' (RiskProfileEntryPointImpl.java:35) advised by around advice from 'com.idna.riskprofile.logging.aspects.RiskLogAspect' (RiskLogAspect.aj:35) [INFO] [aspectj:test-compile {execution: default}] [WARNING] advice defined in com.idna.riskprofile.logging.aspects.RiskLogAspect has not been applied [Xlint:adviceDidNotMatch] [INFO] [resources:resources] </code></pre> <p>Updated: It seems that not weaving advice on the test-compile goal was not what was leading to the test failures on the console but another issue with spring configuration.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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