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.
annotationProcessorconfiguration is available since version 4.x (not sure exactly which version), so if you use older version of Gradle you'll get this error. You should definitely use the Wrapper (see docs.gradle.org/current/userguide/gradle_wrapper.html) to avoid such issueannotationProcessoris available from Gradle 4.6 (see docs.gradle.org/4.6/… ) I guess you have a version < 4.6 on your travis-cigradlecommand too.After I changed it to./gradlew XXX,everything works fine.Thanks again :)