I am currently working on a Gradle 3.3 project in Intellij 15.0.6.
I am using the Gradle APT plugin to add annotation processors to my classpath.
It works fine when generating Java class files, however I need to be able to generate XML sources within the resources
directory equivalent in the build directory's generated directory.
Here is my build directory structure currently:
As you can see, it does not include a resources
directory, which I suspect is what may be causing this problem.
The current exception I receive from running my annotation processor via ./gradlew assemble
is: java.lang.IllegalArgumentException: Resource creation not supported in location CLASS_PATH
The code I am using within my annotation processor to generate the xml file:
FileObject source = processingEnv.getFiler()
.createResource(StandardLocation.CLASS_PATH, "", "ap-test-2.html");
Note: I used an HTML extension just as a test, XML should produce the same results.
javax.tools.StandardLocation
has other output locations as well:
The SOURCE_OUTPUT
location worked to place the XML within the same package as the generated Java classes, within src/apt/main
. This is not my desired behaviour however. I need them to reside within the classpath.
I have not found this exception discussed anywhere else after extensive research.
Any help is appreciated. Thank you for reading this question.