Florian
Florian

Reputation: 5051

Can I share a source folder between two Maven modules in IntelliJ?

I got this structure:

- module-a
  - pom.xml
  - src/main/java
    - some-folder-to-be-shared
    - others
- module-b
  - pom.xml
  - src/main/java

I'd like to include the code in folder some-folder-to-be-shared in both modules.

I have found out how to reach this goal in Maven's pom.xml with the build-helper-maven-plugin.

Unfortunately, this makes IntelliJ assign that folder to module-b and pretending it doesn't exist for module-a.

From the menus and documentation, I couldn't find a way to assign that folder as source two both modules.

Is there a way I can tell IntelliJ that the folder is shared?

Upvotes: 1

Views: 622

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 401877

IntelliJ IDEA project model doesn't support sharing the same content/source root between multiple modules.

I'd extract this folder into a separate module and make your 2 other modules depend on it.

Upvotes: 4

Related Questions