Hello everyone!
I have an own annotation processor (let's call it MyProcessor) and a project (let's call it MyProject) which uses the processor by
passing -processor
to javac
.
Now I need MyProcessor to produce some output and make it available for MyProject.
I have following options (and problems):
Let MyProcessor write a file to the path, specified by the property
user.dir
.
Problem: from the point of view of MyProcessor,user.dir
is always my home dir, not the path of MyProject.Pass the current directory of MyProject to MyProcessor using
javac
's-A
option.
Problem: It's an ugly hard-coded path:/some/path/to/MyProject/
.Let MyProcessor generate some source files, which then would be compiled by
javac
together with MyProject, so that MyProject can refer to this compiled class and retrieve data from it.
Problem: It's too complex for such an easy (?) task.What other options are there?
Can someone please suggest, how to proceed?