Skip to content

Instantly share code, notes, and snippets.

@alex-shpak
Last active January 9, 2020 05:45
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alex-shpak/ce48c3a25f6d8d669f84 to your computer and use it in GitHub Desktop.
Save alex-shpak/ce48c3a25f6d8d669f84 to your computer and use it in GitHub Desktop.
Gradle script for querydsl-apt processor with separate classpath
// apply plugin: 'idea'
sourceSets {
generated.java
main.java.srcDirs += generated.java.srcDirs
}
configurations {
querydslapt
}
dependencies {
querydslapt "com.querydsl:querydsl-apt:$querydslVersion"
}
task querydsl(type: JavaCompile, group: 'build', description: 'Generate the QueryDSL query types') {
source = sourceSets.main.java
classpath = configurations.compile + configurations.querydslapt
options.compilerArgs = [
'-proc:only', //only annotations
'-processor', 'com.querydsl.apt.morphia.MorphiaAnnotationProcessor'
]
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
}
compileJava.dependsOn querydsl
clean {
delete sourceSets.generated.java.srcDirs
}
@sobvan
Copy link

sobvan commented Jun 13, 2016

Thanks a lot!
It was the only hint I could find on integrating custom annotation processor!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment