Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find method lombok() for arguments

Just wanted to include the lombok plugin with my gradle build but get the error message from the title. My build.gradle looks like this:

...
plugins {
    id 'net.ltgt.apt' version '0.10'
}
ext {
    lombok_version="1.16.18"
}
lombok {
    version = ${lombok_version}
    sha256 = ""
}
...
dependencies {
    ...    
    compileOnly "org.projectlombok:lombok:${lombok_version}"
    apt "org.projectlombok:lombok:${lombok_version}"
    ...
}

Source: https://projectlombok.org/setup/gradle

Any ideas what's wrong here? If I remove the lombok {...} part everything works fine.

like image 424
werwuifi Avatar asked Nov 22 '17 22:11

werwuifi


People also ask

How do you use Lombok test?

To set up lombok with any build tool, you have to specify that the lombok dependency is required to compile your source code, but does not need to be present when running/testing/jarring/otherwise deploying your code. Generally this is called a 'provided' dependency.

What is Java Lombok?

What is Lombok. Project Lombok (from now on, Lombok) is an annotation-based Java library that allows you to reduce boilerplate code. Lombok offers various annotations aimed at replacing Java code that is well known for being boilerplate, repetitive, or tedious to write.


1 Answers

According to the documentation you should use either

lombok {
    version = "1.16.18"
    sha256 = ""
}

or

dependencies {
    compileOnly 'org.projectlombok:lombok:1.16.18'
    apt "org.projectlombok:lombok:1.16.18"
}

Disclosure: I am a lombok developer.

like image 152
Roel Spilker Avatar answered Sep 28 '22 10:09

Roel Spilker