How to deal with shared sources in IntelliJ?
In my project, I have three modules. A client module (java client), a server module, and a "shared" module which contains data-transfer-objects which are used on client and server side.
Unfortunately, I cannot add the shared/src folder as content root to the client-, server- and shared-module because it can only be a content root of one module.
So far, I simly added a module dependency to the client- and server module (instead of the content root) to deal with this situation. But now, I want to use maven and I need to include the shared/src folder as source folder to the client/pom.xml and server/pom.xml
Intellij now automatically detects the pom.xml configurations and automatically includes the shared/src folder as content root to the client and server module. Now I always get an error saying the shared/src folder cannot be a content root of multiple modules when I open the project settings dialog.
So what is the preferred / recommended way to deal with shared sources in Intellij?
Please sign in to leave a comment.
Hello,
We have related issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-175569
Currently there is no workaround for that issue due to IDE limitations.
Ok. Thanks for your answer. I´m looking forward to a solution.