I have a project that is laid out as follows:
src/
java
generated
src/java contains jpa entities and query classes that use the jpa metamodel classes that are generated by the hibernate metamodel annotation processor.
What is the best way to incorporate annotation processing into the java plugin?
I currently have the following task defined, but it has a task dependency on compileJava which will fail because some of the code is dependent on the classes that are generated by the annotation processor.
task processAnnotations(type: Compile) {
genDir = new File("${projectDir}/src/generated")
genDir.mkdirs()
source = ['src/java']
classpath = sourceSets.test.compileClasspath
destinationDir = genDir
options.compilerArgs = ["-proc:only"]
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…