W.r.t. Pass options to JPAAnnotationProcessor from Gradle

拟墨画扇 提交于 2019-12-24 02:07:25

问题


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
}

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.


回答1:


Found a solution!

After adding querydsl.entityAccessors=true to aptOptions warning still present, but excluding packages works!

In your case, you should try add -Aquerydsl.entityAccessors=true to options.compilerArgs =[] hope it helps

UPDATED

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!



来源:https://stackoverflow.com/questions/47303776/w-r-t-pass-options-to-jpaannotationprocessor-from-gradle

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