gpt4 book ai didi

java - 如何让 AspectJ 和 Lombok 与 maven 协同工作?

转载 作者:行者123 更新时间:2023-11-29 09:27:47 25 4
gpt4 key购买 nike

我试过这个链接的方法:https://palesz.wordpress.com/2011/12/03/howto-maven-lombok-and-aspectj-together/

但错误显示:

[ERROR] no sources specified
<unknown source file>:<no line information>

[ERROR] AspectJ Compiler 1.8.9

Usage: <options> <source file | @argfile>..

我是这样使用插件的:

<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>

相关的依赖是:

<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>

最佳答案

我按照同一篇文章让它工作,但你忘记了一件事(我也忘记了)。

您需要将 weaveDirectories 添加到配置中:

<weaveDirectories>
<weaveDirectory>${project.build.directory}/classes</weaveDirectory>
</weaveDirectories>

这个原因很明显,因为 sources 标签是空的,aspectj-maven-plugin 需要一些东西来处理。

希望这对您有所帮助。

关于java - 如何让 AspectJ 和 Lombok 与 maven 协同工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44805196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com