【问题标题】:Gradle with ajc doesn't read Lombok annotations带有 ajc 的 Gradle 不读取 Lombok 注释
【发布时间】:2019-01-10 22:02:39
【问题描述】:

我正在尝试将 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、setter 的错误。

【问题讨论】:

    标签: java gradle aspectj spring-aop lombok


    【解决方案1】:

    这对我有用:

    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"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-04
      • 2020-02-07
      • 1970-01-01
      • 2013-09-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多