Gradle : Unable to generate QueryDSL classes

主宰稳场 提交于 2020-06-28 03:55:36

问题


Gradle version: 5.1

Java version: 11

I have the following task defined in gradle file to generate QueryDSL classes:

task generateQClasses (type: JavaCompile) {
    source = sourceSets.main.java.srcDirs
    classpath = sourceSets.main.compileClasspath
    destinationDir = file('src/main/java')
    options.annotationProcessorPath = configurations.annotationProcessor
    options.compilerArgs = ['-proc:only', '-processor', 'com.querydsl.apt.jpa.JPAAnnotationProcessor', '-Aquerydsl.packageSuffix=.querydsl']
}

Below is my dependencies block:

annotationProcessor "com.querydsl:querydsl-apt:4.2.1:jpa"
annotationProcessor "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final"
annotationProcessor "javax.annotation:javax.annotation-api:1.3.2"

If I execute `gradlew generateQClasses, I see the following in the logs:

Attempt to recreate a file for type foo.bar.QClass
error: Attempt to recreate a file for type foo.bar.QClass

It fails with error saying the file already exists. How can I configure this task to overwrite the files if they exist?

Also, the above config is the config for the root project and it has 5 subprojects. AnnotationProcessor is able to overwrite the files in one of the sub project but not the others (all the subprojects have the same config). Am I missing anything?

来源:https://stackoverflow.com/questions/62320937/gradle-unable-to-generate-querydsl-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!