Reputation: 27455
I have the following project:
root
|---pom.xml
src/main/java
|---com.package
|----App.java
src/main/aspects
|---com.package
|----Trace.aj
Now, the pom.xml is
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.package</groupId>
<artifactId>aspectj-test</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>aspectj-test</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>compile</id>
<configuration>
<ajdtBuildDefFile>build.ajproperties</ajdtBuildDefFile>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
After executing mvn aspectj:compile
I got only the App.class
compiled class, but didn't Trace.class
. What's wrong with that?
Upvotes: 0
Views: 1851
Reputation: 44555
By default the aspectj-maven-plugin expects the aspects in the directory src/main/aspect
. If you want to store them in a different directory, you have to specify the configuration:
<configuration>
<aspectDirectory>src/main/aspects</aspectDirectory>
</configuration>
Upvotes: 1