私はそれをテストしませんでしたが、これはうまくいくはずです:
repositories {
mavenCentral()
}
apply plugin: 'java'
dependencies {
compile(group: 'com.mysema.querydsl', name: 'querydsl-apt', version: '1.8.4')
compile(group: 'com.mysema.querydsl', name: 'querydsl-jpa', version: '1.8.4')
compile(group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.6.1')
}
compileJava {
doFirst {
Map otherArgs = [
includeAntRuntime: false,
destdir: destinationDir,
classpath: configurations.compile.asPath,
sourcepath: '',
target: targetCompatibility,
source: sourceCompatibility
]
options.compilerArgs = [
'-processor', 'com.mysema.query.apt.jpa.JPAAnnotationProcessor',
'-s', "${destinationDir.absolutePath}".toString()
]
Map antOptions = otherArgs + options.optionMap()
ant.javac(antOptions) {
source.addToAntBuilder(ant, 'src', FileCollection.AntType.MatchingTask)
options.compilerArgs.each {value ->
compilerarg(value: value)
}
}
}
}
それが役に立てば幸い。