Fork me on GitHub

Including AJDT Projects into Workspace

The Eclipse plugin interacts with the Aspectj plugin to configure Eclipse to use AJDT.

The following example shows how to configure the Eclipse and Aspectj plugin.

<project>
  [...]
  <build>
    [...]
    <plugins>
      [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.10</version>
        <configuration>
          <ajdtVersion>1.5</ajdtVersion>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.1</version>
        <configuration>
          <aspectLibraries>
            <aspectLibrary>
              <groupId>org.thirdparty</groupId>
              <artifactId>jar-containing-external-aspects</artifactId>
            </aspectLibrary>
          </aspectLibraries>
          <weaveDependencies>
            <weaveDependency>
              <groupId>org.mycompany</groupId>
              <artifactId>jar-to-weave-with-aspects-in-this-library</artifactId>
            </weaveDependency>
          </weaveDependencies>
        </configuration>
      </plugin>
      [...]
    </plugins>
    [...]
  </build>
  [...]
</project>

Please see the Aspectj plugin documentation for details on how to configure the aspectj plugin.

The ajdtVersion configuration parameter is optional. The valid values are none, 1.4, and 1.5. none indicates that AJDT should not be enabled even though Aspectj is enabled in maven. 1.4 generates the org.eclipse.ajdt.ui.prefs file in the .settings directory. 1.5 (or later) includes the configuration into the .classpath file and is the default value.