Gradle 使用 ajc 不读取 Lombok 注释

Gradle with ajc doesn't read Lombok annotations

我正在尝试将 ajc 编译器作为 gradle 插件添加到我的 gradle 项目中。不幸的是,在编译过程中,由于 Lombok,它向我显示了大量错误。

build.gradle:

group 'com.kmb.bank'
version '0.0.1-SNAPSHOT'

project.ext {
    aspectjVersion = '1.9.2'
}

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "gradle.plugin.aspectj:gradle-aspectj:0.1.6"
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "aspectj.gradle"

sourceCompatibility = 11
targetCompatibility = 11

repositories {
    mavenCentral()
}

dependencies {
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.7'
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile group: 'commons-codec', name: 'commons-codec', version: '1.11'

    implementation('org.springframework.boot:spring-boot-starter-amqp')
    implementation('org.springframework.boot:spring-boot-starter-web')
    compile("org.springframework.boot:spring-boot-starter-thymeleaf")
    compile ('org.springframework.boot:spring-boot-starter-security')
    compile("org.springframework.boot:spring-boot-starter-data-mongodb")
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-   aop', version: '2.1.1.RELEASE'
    }

它向我显示没有 getter 每个模型的设置器的错误。

这对我有用:

plugins {
    id 'java'
    id "io.freefair.aspectj.post-compile-weaving" version "4.1.4"
}

group 'com.amdocs'
version '1.0.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile group: 'org.projectlombok', name: 'lombok', version: '1.18.10'
    annotationProcessor "org.projectlombok:lombok:1.18.10"
}