logo Mojo's AspectJ Maven Plugin

Handles AspectJ usage within Maven. Functionality provided is: weaving of aspects (or existing aspects from libraries) with the test and/or main classes, weaving of pre-existing jars and ajdoc reporting.

homepage: www.mojohaus.org/mojo-parent
fresh index:
last release: 6 months ago, first release: 2 decades ago
packaging: maven-plugin
get this artifact from: central
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
aspectj:aspectj-report

Creates an AspectJ HTML report using the {@code ajdoc} tool and format. A Maven 2.0 ajdoc report

aspectj:compile (phase: compile)

Weaves all main classes. AspectJ Compiler Plugin.

aspectj:EclipseAjcMojo

Create eclipse configuration of aspectJ

aspectj:help

Display help information on aspectj-maven-plugin. Call mvn aspectj:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.

aspectj:test-compile (phase: test-compile)

Weaves all test classes. AspectJ Compiler Plugin.

Often used code snippets:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <version>1.8</version>
  <configuration>
    <source>1.7</source>
    <target>1.7</target>
    <complianceLevel>1.7</complianceLevel>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <version>1.8</version>
  <configuration>
    <source>1.8</source>
    <target>1.8</target>
    <complianceLevel>1.8</complianceLevel>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <version>1.8</version>
  <configuration>
    <source>1.8</source>
    <target>1.8</target>
    <complianceLevel>1.8</complianceLevel>
    <excludes>
      <exclude>**/thrift/*Service.java</exclude>
    </excludes>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <version>1.2</version>
  <dependencies>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <version>${org.aspectj-version}</version>
    </dependency>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjtools</artifactId>
      <version>${org.aspectj-version}</version>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
        <goal>test-compile</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <outxml>true</outxml>
    <source>${java-version}</source>
    <target>${java-version}</target>
  </configuration>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <executions>
    <execution>
      <id>backward-compatibility-aspects</id>
      <goals>
        <goal>compile</goal>
      </goals>
      <configuration>
        <aspectDirectory>src/main/aspect/compatibility</aspectDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.