1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gradle5 で Lombok が使えない

Last updated at Posted at 2019-11-23

macOS x IDEA x Gradle5 x Spring-boot2 で Lombok を使おうとして、コンパイルはできるがビルドができない。

アノテーションの設定や Lombok Plugin の設定は済んでいて、@Slf4 を記述し、log.debug を記載してエディタ上でエラーは発生しないけど、ビルドすると以下エラーが発生する。

/src/to/path/TestController.java:14: エラー: シンボルを見つけられません
        log.info("start");
        ^
  シンボル:   変数 log
  場所: クラス TestController

以下の設定を build.gradle に追加したら解決

compileOnly group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"

※「providedCompile」で読み込もうとしていたのが誤りのようでした。

参考:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003400520-Intellij-Idea-Lombok-Gradle-5-broken-build

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?