gradle 6.4 构建使用 lombok 1.18.12 不生成 getter 和 setter。

huangapple go评论77阅读模式
英文:

gradle 6.4 build with lombok 1.18.12 not generating getters and setter

问题

Tried adding

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

and specified version in versions.gradle

lombokVersion="1.18.12"

Still compilation is failing with missing getter/setters.
Used --debug option and extracted arguments passed to java compiler and executed with javac and compilation went fine.
Tried overriding java compiler option via gradle command line option and via following properties

compileJava.options.fork = true
compileJava.options.forkOptions.executable = '/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/bin/javac'

Still no luck. It still seems to be using internal groovy compiler org.gradle.api.internal.tasks.compile.JdkJavaCompiler
Anyone ran into similar issue?

英文:

Tried adding

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

and specified version in versions.gradle

lombokVersion="1.18.12"

Still compilation is failing with missing getter/setters.
Used --debug option and extracted arguments passed to java compiler and executed with javac and compilation went fine.
Tried overriding java compiler option via gradle command line option and via following properties

compileJava.options.fork = true
compileJava.options.forkOptions.executable = '/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/bin/javac'

Still no luck. It still seems to be using internal groovy compiler org.gradle.api.internal.tasks.compile.JdkJavaCompiler
Anyone ran into similar issue?

答案1

得分: 0

已将Lombok依赖项添加到common/build.gradle中:

    compileOnly 'org.projectlombok:lombok:1.18.12'
    annotationProcessor 'org.projectlombok:lombok:1.18.12'

    testCompileOnly 'org.projectlombok:lombok:1.18.12'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
英文:

Added lombok dependencies to common/build.gradle

    compileOnly 'org.projectlombok:lombok:1.18.12'
    annotationProcessor 'org.projectlombok:lombok:1.18.12'

    testCompileOnly 'org.projectlombok:lombok:1.18.12'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'

huangapple
  • 本文由 发表于 2020年10月7日 13:55:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/64238008.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定