Maven + AspectJ - all steps to configure it
- by Alice
I have a problem with applying aspects to my maven project. Probably I am missing something, so I've made a list of steps. Could you please check if it is correct?
Let say in projectA is an aspect class and in projectB classes, which should be changed by aspects.
Create maven project ProjectA with AspectJ class
add Aspectj plugin and dependency
Add ProjectA as a dependency to projectB pom.xml
Add to projectB pom.xml plugin
"
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<aspectLibraries>
<aspectLibrary>
<groupId>ProjectA</groupId>
<artifactId>ProjectA</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
</plugin>
Add aspectj dependency
After all these steps my problem is, that during compilation I get:
[WARNING] advice defined in AspectE has not been applied [Xlint:adviceDidNotMatch]
And then when I run my program:
Exception in thread "FeatureExcutionThread" java.lang.NoClassDefFoundError: AspectE