简体   繁体   中英

If I add the dependency of Lombock in gradle file, it does not build

I added Lombock to the gradle file, but I have a problem with building a gradle.

buildscript {
ext {
    springBootVersion = '2.0.0.M7'
}
repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-
 plugin:${springBootVersion}")
  }
}
   apply plugin: 'java'
   apply plugin: 'eclipse'
   apply plugin: 'org.springframework.boot'
   apply plugin: 'io.spring.dependency-management'

   group = 'com.crud'
   version = '0.0.1-SNAPSHOT'
   sourceCompatibility = 1.8

    repositories {
      mavenCentral()
      maven { url "https://repo.spring.io/snapshot" }
       maven { url "https://repo.spring.io/milestone" }
   }
   dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
compileOnly ('org.projectlombok:lombok:1.16.18')
apt("org.projectlombok:lombok:1.16.18")
  }

Error A problem occurred evaluating root project 'task'.

Could not find method apt() for arguments [org.projectlombok:lombok:1.16.18] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependenc yHandler.

How to solve this problem

It seems to me that the issue is not with lombok , but with the missing apt plugin. Try applying it, as described here , ie add the following to your gradle file:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "net.ltgt.gradle:gradle-apt-plugin:0.13"
  }
}

apply plugin: "net.ltgt.apt"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM