Hello:
I want to know it it's possible, with
Maven, to post-process the original source files of my project, generate the resulting files in an intermediate source directory, and make "maven-compiler-plugin" to compile from there instead of from the original directory. By "post-process" I mean to process the source files with something that replaces text sequences, be it a custom plug-in or a typical command such as
sed or
perl. But my question is not related to this last point, but to configuring the directory.
With Ant it's moderately easy. But with Maven, it doesn't seem so. I prefer not to change the
<sourceDirectory> tag in
<build>, because I still want that the original directory is the reference one. One of the reasons for this is that NetBeans, which is the
IDE that I'm using, wouldn't show the original files in its project panel, but the post-processed ones. I couldn't edit the original files with ease. I would lose the ability to refactor, the automatic dependency check, etc.
One idea that I've had is to try with the
<includes> configuration parameter of the
maven-compiler-plugin. But I've read that it was deprecated several versions ago.
Another idea is to use the
build-helper-maven-plugin and its
add-source goal. To add the directory of post-processed files as an additional source, and expect that the compiled files overwrite the ones of the original. However, the compiler actually fails indicating that the classes are duplicated (I've just tested it).
Do you have a better idea? Thank you!