For my project, I want to use Maven for builds and git submodules. I have a bunch of java files I’d like to be able to reference from several applications within the project, keeping the files consistent between applications. Creating a repo for these files and adding them as submodules to my applications seemed like the way to go. The files in the repo can be structured in whatever way is most convenient.
I’d like to, if possible, respect the Maven standard directory structure. However, it seems that git can only add submodules as immediate subdirectories of the parent repo. While this may not actually inibit following Maven standard directory structure, I haven’t figured out how to make it work.
Is it possible to use these two tools together in perfect harmony, such that I don’t have to manually tinker with poms? If so, how?
I believe what you are trying to do is against Maven’s idea. You shouldn’t share source code in such sense. Why not make a separate artifact for the shared code and put it as a dependency in those application?