我使用的是Gradle 2.14版,我对build.gradle
进行了更改,以从question中提到的JPAAnnotationProcessor
中排除软件包。
我的build.gradle
配置如下:
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]'
的警告并且指定的程序包不会从预处理中排除。
最佳答案
找到了解决方案!
将querydsl.entityAccessors=true
添加到aptOptions后,警告仍然存在,但排除软件包有效!
在您的情况下,您应该尝试将-Aquerydsl.entityAccessors=true
添加到options.compilerArgs =[]
希望能帮助到你
更新了
只是注意到您在项目中使用了lombook。
找到了这个(How to make QueryDSL and Lombok work together)希望对您有帮助!
关于jpa - 。从Gradle将选项传递给JPAAnnotationProcessor,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47303776/