2

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.

MasterCode
  • 975
  • 5
  • 21
  • 44

1 Answers1

3

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!

  • Thanks for responding but above solution also not working for me.Now it giving warning as:The following options were not recognized by any processor: '[querydsl.entityAccessors, querydsl.excludedPackages]' – MasterCode Mar 12 '19 at 12:34
  • 1
    yes, warining is present for me too, but excluding works – Daniil Volkov Mar 13 '19 at 07:28
  • 1
    just noticed that you use lombook in your project. Found this one ( https://stackoverflow.com/questions/44522494/how-to-make-querydsl-and-lombok-work-together) Hope it could be helpful for you – Daniil Volkov Mar 13 '19 at 14:50
  • 2
    The solution mentioned in above link worked for me. Please edit answer previously given by you so that I can accept it. Thanks for helping, I owe you one answer to one of your query or a coffee may be.Saved lot of time – MasterCode Mar 14 '19 at 07:25