Querydsl Annotation Processor issue after upgrade to Gradle 5

后端 未结 6 1143
孤独总比滥情好
孤独总比滥情好 2021-01-02 19:13

I have a gradle script which generates querydsl classes from Mongo annotated entities. It was working so far, but after upgrade to Gradle 5 I have a problem with:

         


        
6条回答
  •  Happy的楠姐
    2021-01-02 19:50

    The configuration i am using,it works:

        plugins {
        id 'org.springframework.boot' version '2.2.5.RELEASE'
        id 'io.spring.dependency-management' version '1.0.9.RELEASE'
        id 'java'
        id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
    
    }
    
    group = 'io.loremipsum'
    version = '0.0.1-SNAPSHOT'
    sourceCompatibility = '11'
    
    
    repositories {
        mavenCentral()
    }
    
    
    querydsl {
        library = 'com.querydsl:querydsl-apt:4.1.4'
        querydslSourcesDir = 'src/main/querydsl'
        springDataMongo = true
    }
    
    sourceSets {
        main {
            java {
                srcDirs = ['src/main/java', 'src/main/querydsl']
            }
        }
    }
    // is required when gradle > 5.0
    compileQuerydsl {
        options.annotationProcessorPath = configurations.querydsl
    }
    
    dependencies {
        compile 'org.springframework.boot:spring-boot-starter-data-mongodb'
        compile 'org.springframework.boot:spring-boot-starter-web'
    
        compile("com.querydsl:querydsl-core:4.1.4")
        compile("com.querydsl:querydsl-mongodb:4.1.4")
        compile("com.querydsl:querydsl-apt:4.1.4")
    
        compile 'org.projectlombok:lombok'
        annotationProcessor 'org.projectlombok:lombok'
    
        testCompile('org.springframework.boot:spring-boot-starter-test')
        testCompile 'de.flapdoodle.embed:de.flapdoodle.embed.mongo'
    }
    

    pay attention to the dependency declaration:

    compile 'org.springframework.boot:spring-boot-starter-data-mongodb'
    

    implementation dependency should not be used or will result in an exception:

    Annotation processor 'org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor' not found
    

提交回复
热议问题