13

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.

3
  • 3
    this means you are using an older version of Gradle on your Travis-ci : the annotationProcessor configuration 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 issue Commented Feb 28, 2019 at 8:16
  • 1
    This annotationProcessor is available from Gradle 4.6 (see docs.gradle.org/4.6/… ) I guess you have a version < 4.6 on your travis-ci Commented Feb 28, 2019 at 8:34
  • @M.Ricciuti Wow~Thank you!!! I have solved my problem after read your word.I used the Wrapper,but I used the gradle command too.After I changed it to ./gradlew XXX,everything works fine.Thanks again :) Commented Feb 28, 2019 at 9:37

2 Answers 2

22

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.

Sign up to request clarification or add additional context in comments.

Comments

0

A ery easy way to update the gradle version of your project in intellij is to go to inside your project, gradle, wrapper, gradle-wrapper.properties and update the version in the line below: disributionUrl=https://services.gradle.org/distributions/gradle-4.6-bin.zip

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.