I have multiple projects, some are single module, and others are multi-module. Some of these modules are libraries intended to be used in multiple projects.
How do I share these modules between projects, and what would I store in version control?
If I store each module in it’s own repository, then the .idea folders will not be available, and as such information about the module such as its dependencies, copyright notices, artefact config etc will be missing. Therefore, I would like to store each project in a repository, but then how would I reference one module from another project as a dependency?
Note: I am using git for version control.
I would either have a project for common modules, or add them to each project.
I wouldn’t store IntelliJ specific files if you are working with another developer. If not, you can just store everything. What ever you do, you can swap later.
Or in its own sub-directory. Git does encourage creating more repositories, either way works.
I would check them in anyway, but if you check them in, they are as available as any other file.
I would use maven for dependencies and build.
You can import a module from one project to another in IntelliJ, but I would use maven which supports this.