W.r.t.从Gradle将选项传递给JPAAnnotationProcessor [英] W.r.t. Pass options to JPAAnnotationProcessor from Gradle
问题描述
我正在使用Gradle 2.14版本,我已经在build.gradle
中进行了更改,以将JPAAnnotationProcessor
中的软件包排除在外,如
I am using Gradle version 2.14, I have made changes in build.gradle
to exclude packages from JPAAnnotationProcessor
as mentioned in question.
My build.gradle
configuration for same as follows:
configurations {
querydslapt
}
dependencies{
compile group: 'com.querydsl', name: 'querydsl-core', version: '4.1.4'
compile group: 'com.querydsl', name: 'querydsl-apt', version: '4.1.4'
compile group: 'com.querydsl', name: 'querydsl-jpa', version: '4.1.4'
}
task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
source =sourceSets.main.java
classpath = configurations.compile + configurations.querydslapt
options.compilerArgs = [
"-proc:only",
"-processor", "com.querydsl.apt.jpa.JPAAnnotationProcessor",
"-Aquerydsl.excludedPackages=com.projectx.data.domain.poc.lombok"
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}
compileJava {
dependsOn generateQueryDSL
source generateQueryDSL.destinationDir
}
compileGeneratedJava {
dependsOn generateQueryDSL
options.warnings = false
classpath += sourceSets.main.runtimeClasspath
}
但是当我构建应用程序时,我得到的警告是warning: The following options were not recognized by any processor: '[querydsl.excludedPackages]'
But when I am building application I getting warning as warning: The following options were not recognized by any processor: '[querydsl.excludedPackages]'
指定的程序包不会从预处理中排除.
And specified packages are not excluded from preprocessing.
推荐答案
找到了解决方案!
将querydsl.entityAccessors=true
添加到aptOptions后,警告仍然存在,但是排除软件包仍然有效!
After adding querydsl.entityAccessors=true
to aptOptions warning still present, but excluding packages works!
在您的情况下,应尝试将-Aquerydsl.entityAccessors=true
添加到options.compilerArgs =[]
希望对您有帮助
In your case, you should try add -Aquerydsl.entityAccessors=true
to options.compilerArgs =[]
hope it helps
已更新
刚注意到您在项目中使用lombook. 找到了这个(如何使QueryDSL和Lombok协同工作 )希望对您有帮助!
Just noticed that you use lombook in your project. Found this one ( How to make QueryDSL and Lombok work together ) Hope it could be helpful for you!
这篇关于W.r.t.从Gradle将选项传递给JPAAnnotationProcessor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!