我试图将Lombok与AspectJ和Maven结合使用。那么,有什么问题吗?当我使用AspectJ Maven插件(www.mojohaus.org/aspectj Plugin /)时,它获取源代码并编译它们,并忽略Lombok所做的更改。我跟踪了本教程,并想出了这段代码和AspectJ works,但是Lombok死了,带着这样的消息:
[WARNING] You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.
Your processor is: org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.BatchProcessingEnvImpl
Lombok supports: sun/apple javac 1.6, ECJ那么,有谁知道如何将Lombok与AspectJ结合起来呢?
编辑它的作品!现在,当我将项目打包到一个胖罐子中时,它似乎起了作用。但是它仍然不适用于maven:test和IntelliJ。如果有人能解决这个问题我会很高兴的。
诚挚的问候!
发布于 2018-10-18 08:04:36
使用ajc处理类。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.11</version>
<configuration>
<complianceLevel>8</complianceLevel>
<source>8</source>
<target>8</target>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<Xlint>ignore</Xlint>
<encoding>UTF-8</encoding>
<!-- IMPORTANT-->
<excludes>
<exclude>**/*.java</exclude>
</excludes>
<forceAjcCompile>true</forceAjcCompile>
<sources/>
<!-- IMPORTANT-->
<aspectLibraries>
<aspectLibrary>
<groupId>you.own.aspect.libary</groupId>
<artifactId>your-library</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>process-classes</phase>
<goals>
<!-- use this goal to weave all your main classes -->
<goal>compile</goal>
</goals>
<configuration>
<weaveDirectories>
<weaveDirectory>${project.build.directory}/classes</weaveDirectory>
</weaveDirectories>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<phase>process-test-classes</phase>
<goals>
<!-- use this goal to weave all your test classes -->
<goal>test-compile</goal>
</goals>
<configuration>
<weaveDirectories>
<weaveDirectory>${project.build.directory}/test-classes</weaveDirectory>
</weaveDirectories>
</configuration>
</execution>
</executions>
</plugin>发布于 2017-11-25 16:04:39
使用delombok生成正常的源代码。如果Lombok不被使用的话,那就照你说的做吧。
将您的lombok注释代码存储在main/src/lombok (例如)中,然后让delombok插件将这些注释转换为普通代码并转换为/delomboked目录(例如)。
发布于 2019-01-27 23:33:34
我尝试了各种解决方案,最后指定javac编译器选项,如下所示

https://stackoverflow.com/questions/41910007
复制相似问题