Java 如何使AspectJ和Lombok与maven协同工作?
我在这个链接中尝试了以下方法: 但错误表明:Java 如何使AspectJ和Lombok与maven协同工作?,java,maven,aspectj,lombok,Java,Maven,Aspectj,Lombok,我在这个链接中尝试了以下方法: 但错误表明: [ERROR] no sources specified <unknown source file>:<no line information> [ERROR] AspectJ Compiler 1.8.9 Usage: <options> <source file | @argfile>.. [错误]未指定源 : [错误]AspectJ编译器1.8.9 用法:。。 我使用的插件
[ERROR] no sources specified
<unknown source file>:<no line information>
[ERROR] AspectJ Compiler 1.8.9
Usage: <options> <source file | @argfile>..
[错误]未指定源
:
[错误]AspectJ编译器1.8.9
用法:。。
我使用的插件如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.10</version>
<configuration>
<verbose>true</verbose>
<showWeaveInfo />
<forceAjcCompile>true</forceAjcCompile>
<sources />
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
org.codehaus.mojo
aspectj maven插件
1.10
真的
真的
1.8
1.8
1.8
进程类
编译
测试编译
而相关的依赖关系是:
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
</dependency>
org.aspectj
aspectjrt
1.8.10
org.aspectj
aspectjweaver
1.8.10
我跟随同一篇文章来让它工作,但你忘了一件事(我也忘了)
您需要将weaveDirectories添加到配置中:
<weaveDirectories>
<weaveDirectory>${project.build.directory}/classes</weaveDirectory>
</weaveDirectories>
${project.build.directory}/classes
这个原因很明显,因为sources标签是空的,aspectj maven插件需要一些东西来处理
希望这有帮助