<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.10</version>
<configuration>
<verbose>true</verbose>
<showWeaveInfo>true</showWeaveInfo>
<source>1.8</source>
<target>1.8</target>
<complianceLevel>1.8</complianceLevel>
<verbose>false</verbose>
<Xlint>ignore</Xlint>
<outxml>true</outxml>
<forceAjcCompile>true</forceAjcCompile>
<reweavable>false</reweavable>
<!-- this is important: start-->
<sources/>
<weaveDirectories>
<weaveDirectory>${project.build.directory}/classes</weaveDirectory>
</weaveDirectories>
<!-- this is important: end-->
</configuration>
<executions>
<execution>
<!-- The right phase is very important! Compile and weave aspects after all classes compiled by javac -->
<phase>process-classes</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.9</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.8.9</version>
</dependency>
</dependencies>
</plugin>
According to the standard, the aspectj-maven-plugin provides weaving during compilation. But Lombok is a compile-time preprocessor. Therefore, in order for the weaving to occur after the code is compiled, the following is necessary.
In the plugin:
<forceAjcCompile>true</forceAjcCompile> и <sources/>
You also need to turn off the autobuild in Intellij Idea. And execute the following command:
mvn clean compile install -Pdev
Only as a result of this command, the necessary weaving begins! Because of the "install" command.
Tell me, please, why is the weaving happening only thanks to this command? Or are other command options possible, for example, so that tests are not pulled up, etc.?