Lombok 在 quarkus 扩展中不起作用

发布于 2025-01-18 12:42:26 字数 875 浏览 0 评论 0原文

这是我第一次编写 Quarkus 扩展,并且在使用 Lombok 时遇到了问题,之后,我将依赖项添加到了 pom 的依赖项列表中,并在 eclipse 中安装了 Lombok,IDE 在编写代码期间运行良好,但是当我想在编译后测试它时,应用程序崩溃了,因为它无法找到 Lombok 应该生成的代码。

这就是我们在 pom 中导入它的方式:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <scope>compile</scope>
    <optional>true</optional>
</dependency>

这是错误

[ERROR]/C:/Users/daniele/Documents/GitHub/jrv_library_bean_monitoring_quarkus/sources/JarvisBeanMonitoringQuarkusLib/deployment/src/test/java/com/jarvis/quarkus/monitoring/lib/test/QuarkusMonitoringLibTest.java:[25,10] cannot find symbol
[ERROR]   symbol:   method setMessage(java.lang.String)
[ERROR]   location: variable x of type com.jarvis.monitoring.bean.OutputBean

It's the first time that I have to write a Quarkus extension and I'm having problems with Lombok, after that, i have added the dependency to the pom's dependencies list and installed Lombok in eclipse the IDE works well during the writing of the code, but when i want to test it after compiling it the application broke because it's not able to find the code the code that Lombok should have generated.

that's how we imported it in pom:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <scope>compile</scope>
    <optional>true</optional>
</dependency>

an this is the error

[ERROR]/C:/Users/daniele/Documents/GitHub/jrv_library_bean_monitoring_quarkus/sources/JarvisBeanMonitoringQuarkusLib/deployment/src/test/java/com/jarvis/quarkus/monitoring/lib/test/QuarkusMonitoringLibTest.java:[25,10] cannot find symbol
[ERROR]   symbol:   method setMessage(java.lang.String)
[ERROR]   location: variable x of type com.jarvis.monitoring.bean.OutputBean

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经暖 2025-01-25 12:42:26

调整扩展程序的编译器插件配置。应该是这样的:

<build>
<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
      <annotationProcessorPaths>
        <path>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok</artifactId>
          <version>1.18.24</version>
        </path>
        <path>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-extension-processor</artifactId>
          <version>${quarkus.version}</version>
        </path>
      </annotationProcessorPaths>
    </configuration>
  </plugin>
</plugins>

Adjust compiler plugin config for your extension. Should be something like that:

<build>
<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
      <annotationProcessorPaths>
        <path>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok</artifactId>
          <version>1.18.24</version>
        </path>
        <path>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-extension-processor</artifactId>
          <version>${quarkus.version}</version>
        </path>
      </annotationProcessorPaths>
    </configuration>
  </plugin>
</plugins>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文