Maven’s multi-modules plugin doc states clearly:
Modules are regular Maven projects which must be located under a subdirectory so the parent project can retrieve them easily.
The thing is I don’t want to locate them under a subdirectory. I just want to point to some file path which can be used in order to compile dependencies. (Highlighted, since this is the question actually).
The reason I want it is simple: I just don’t want to mess two completely different paradigms – maven modules and git submodules – in one folder. Moreover, I don’t want to have any kind of git dependencies in the project.
Solution number 0, i.e. to create simlinks and to put them to .gitignore does not count 😉
The best solution is to create the directory structure within a single git repository and don’t use submodules in Git. This will result in a structure like this:
The above structure will be put under Git version control with the root folder which comprises of the sub modules as well. Not submodules etc. in Git.
If you have dependencies in this scenario you have to use module dependencies which are the best practice in Maven.