Closed cvgaviao closed 4 years ago
Not sure what could be missing here. Would you mind creating a complete test case so we can reproduce it?
Not sure what could be missing here. Would you mind creating a complete test case so we can reproduce it?
Hi @lukaseder, thanks for your time.
I've pushed an initial code of my annotation processor project to github: https://github.com/cvgaviao/c8tech-jlib-i18n/blob/master/c8tech-jlib-i18n-apt/src/test/java/br/com/c8tech/jlib/i18n/apt/MessageBundleAnnotationProcessorTest.java
Note that when running this test the resulting artifacts are being created inside the c8tech-jlib-i18n-apt/ directory.
I see, so the processor is here: https://github.com/cvgaviao/c8tech-jlib-i18n/blob/c9b1b11ddd74f767be2b1f72f04fa7b62ae8c92b/c8tech-jlib-i18n-apt/src/main/java/br/com/c8tech/jlib/i18n/apt/MessageBundleGeneratorAnnotationProcessor.java, for the record.
Have you tried specifying the -s
option in your CompileOptions
?
Have you tried specifying the
-s
option in yourCompileOptions
?
Wow, this is it !!!
I've passed too many years running tests with maven/eclipse and I never noted that they provide that -s
to the compiler :( .
As I'm using Junit5, I've created a simple extension that creates and injects the method test's directory into a Path method parameter. So the developer just need to use it to set the -s
option.
I'll will commit and post the link here soon. Perhaps others need it too.
thanks !
@lukaseder, one more question:
Do I need to set any parameter in order to see the messages provided to processingEnv.getMessager().printMessage()
method?
Have you tried specifying the
-s
option in yourCompileOptions
?
Well, actually the use of -s
do not resolved my problem. It was partially resolved by using -d
.
When generating resource files using processingEnv.getFiler().createResource
. The resource are correctly created in the directory passed to -d
option.
But unfortunately, neither -s
or -d
is working when generating source files using processingEnv.getFiler().createSourceFile
.
Somehow the calculated directory being used is something like this: org.joor.Compile$JavaFileObject[string:///br/com/c8tech/jlib/i18n/apt/SourceResourceBundleWithTwoMethodsAndMultipleLocalesImpl.java]
Do I need to set any parameter in order to see the messages provided to processingEnv.getMessager().printMessage() method?
I guess that's currently not possible yet. The output appears in the exception in case of a compilation error, but not in case of the happy path. I've created a feature request for this: https://github.com/jOOQ/jOOR/issues/88
I'm trying to create an annotation processor class and started to use JOOR to test it.
In the class under test I'm creating a resource file:
I'm running the test inside Eclipse IDE and I was expecting that the resulting files was being created inside a specific test directory under project's \target directory, but it is being created inside my annotation processor project's directory instead.
Am I missing something ?