I have a project that uses the -J flag in an interesting way.
The only issue with it is that I don't agree with the warning I get:
Warning Invalid source/import path: /home/alex/Documents/code/dubhell/p1/$ROOT_PACKAGE_DIR/source
There is nothing invalid about this path and it works fine.
Solution
Ignore the path check for $ROOT_PACKAGE_DIR paths.