Maven不支持lombok的問題

    工程基於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>

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章