Fork me on GitHub

Separate test/compile settings

Example of different configurations for compile and test-compile goal

To have different weaving configurations for the main and test classes, you can configure the plugin as shown below.

<project>
  <!-- ... -->
  <dependencies>
    <!-- ... -->
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <version>${aspectjVersion}</version>
    </dependency>
    <!-- ... -->
  </dependencies>
  <!-- ... -->
  <build>
    <plugins>
      <plugin>
        <groupId>${project.groupId}</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>${project.version}</version>
        <executions>
          <execution>
            <id>compile</id>
            <configuration>
              <ajdtBuildDefFile>build.ajproperties</ajdtBuildDefFile>
            </configuration>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>test-compile</id>
            <configuration>
              <ajdtBuildDefFile>test.ajproperties</ajdtBuildDefFile>
            </configuration>
            <goals>
              <goal>test-compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- ... -->
    </plugins>
  </build>
  <!-- ... -->
</project>