Search code examples
gradletravis-cilombok

Could not find method annotationProcessor() for arguments


Following is my build.gradle file. My project compiles locally (IntelliJ-IDEA is my IDE), but when I push it to GitHub, the travis-ci build fails. My gradle version is gradle-5.2.

apply plugin: "java"
apply plugin: 'jacoco'

sourceCompatibility = 1.8
version = "1.0"

repositories {
  mavenCentral()
}


dependencies {
  annotationProcessor 'org.projectlombok:lombok:1.18.2'
  compileOnly 'org.projectlombok:lombok:1.18.2'
  testAnnotationProcessor 'org.projectlombok:lombok:1.18.2'
  testCompileOnly 'org.projectlombok:lombok:1.18.2'
}

FAILURE: Build failed with an exception.

  • Where: Build file '/home/travis/build/XXX/PROJECT/build.gradle' line: 33
  • What went wrong: A problem occurred evaluating root project 'PROJECT'.

Could not find method annotationProcessor() for arguments [org.projectlombok:lombok:1.18.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

The annotationProcessor in build.gradle seems not to be parsed, I'm not sure what the underlying issue is. Any help would be appreciated. Thanks.


Solution

  • As @M.Ricciuti said, the annotationProcessor is available from gradle versions 4.6 and later. So what we should do is just confirm that gradle's version >= 4.6. We'd be better off using the Wrapper.Thanks, that's all.