Intellij + Ajc + Lombok/Mapstruct

Hi I had similar issue.

The fix was to let aspectj-maven-plugin to only start weaving after classes are compiled.

It describes in more detail here https://www.mojohaus.org/aspectj-maven-plugin/examples/weaveDirectories.html

I needed to:

(1) Specify folder where already compiled classes will be via <weaveDirectories >

(2) Change the phase of maven-compiler-plugin lifecycle to be run "process-classes" or later.

This is how my pom looked like.

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.mapstruct</groupId>
                        <artifactId>mapstruct-processor</artifactId>
                        <version>${mapstruct.version}</version>
                    </path>
                    <path>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>${org.projectlombok.version}</version>
                    </path>
                </annotationProcessorPaths>
                <compilerArgs>
                    <compilerArg>-Amapstruct.defaultComponentModel="spring"</compilerArg>
                    <compilerArg>-Amapstruct.unmappedTargetPolicy=ERROR</compilerArg>
                    <compilerArg>-Amapstruct.suppressGeneratorTimestamp=true</compilerArg>
                    <compilerArg>-Amapstruct.suppressGeneratorVersionInfoComment=true</compilerArg>
                </compilerArgs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <configuration>
                <showWeaveInfo>${showWeaveInfo}</showWeaveInfo>
                <showWeaveInfo>true</showWeaveInfo>
                <Xlint>ignore</Xlint>
                <complianceLevel>${java.compiler.version}</complianceLevel>
                <encoding>UTF-8</encoding>
                <verbose>false</verbose>
                <verbose>true</verbose>
                <forceAjcCompile>true</forceAjcCompile>
                <sources/>
                <weaveDirectories>
                    <weaveDirectory>${project.build.directory}/classes</weaveDirectory>
                </weaveDirectories>
                <aspectLibraries>
                    <aspectLibrary>
                        <groupId>com.lib.test</groupId>
                        <artifactId>test1</artifactId>
                    </aspectLibrary>
                    <aspectLibrary>
                        <groupId>com.lib.test2</groupId>
                        <artifactId>test2</artifactId>
                    </aspectLibrary>
                </aspectLibraries>
            </configuration>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>compile</goal>
                        <goal>test-compile</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjtools</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjrt</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

Enabling Post-compile weave mode in IntelliJ solved it for me (https://www.jetbrains.com/help/idea/using-the-aspectj-ajc-compiler.html).