Home | RU | EN

Maven configuration for AspectJ Weaver

Pay attention: for the dependency to work you also need to add the following snippets to your pom.xml:

Into maven-surefire-plugin configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <configuration>
        <useModulePath>false</useModulePath>
        <argLine>
            ${argLine}
            -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/1.9.24/aspectjweaver-1.9.24.jar"
            -Daj.weaving.verbose=false
        </argLine>
    </configuration>
</plugin>
Pay attention. The version 1.9.24 above is an example. In the -javaagent parameter you must specify the actual version of aspectjweaver that you added as a dependency. Make sure to update it accordingly in your project.

And into properties:

<properties>
    <!--  so that ${argLine} won't remain a literal -->
    <argLine/>
</properties>