Description
Hi,
I just stumbled on this amazing project, but must be missing something quite basic:
So I've written an AnnotationProcessor that generates a Java output file. The idea is to replace a whole bunch of (so far) handwritten files which are virtually identical except for one import (let's not go into the details, I've just started). So my simple test idea was to use one of those existing files as expected generated output. But what happens is that the tool tries to compile the generated file - which fails due to the missing imports. I don't want to copy half of our sourcecode around, I'd be happy if it ran only the annotation processor.
I tried this:
final Compilation compilation = javac().withProcessors(processor).withOptions("-proc:only") .compile(JavaFileObjects.forResource("AnnotatedResource.java"));
But it's still telling me:
java.lang.IllegalStateException: compilation failed, so generated files are unavailable. Compilation produced the following diagnostics: /SOURCE_OUTPUT/<path/to/generated/file>
etc.
What am I doing wrong?