欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Maven不支持lombok的问题

程序员文章站 2022-07-13 09:08:07
...

    工程基于Maven,使用到了Lombok,编译时提示以下错误导致找不到Lombok库而编译通不过。

[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.wp:demo:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.scope' for org.projectlombok:lombok:jar must be one of [provided, compile, runtime, test, system] but is 'annotationProcessor'. @ line 37, column 14
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]

 

    解决方法:在pom.xml中,修改Lombok的依赖,

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>annotationProcessor</scope>
    </dependency>

将<scope>annotationProcessor</scope>改为<scope>provided</scope>