IntelliJ with multiple Maven projects - Modules shadowing each other
I have an example project with the following file structure
root/
parent/
pom.xml
src/
...
child/
pom.xml
src/
...
These are the two POM files:
root/parent/pom.xml:
...
<groupId>com.example</groupId>
<artifactId>foo.bar</artifactId>
...
root/child/pom.xml:
...
<groupId>com.example</groupId>
<artifactId>foo.bar.baz</artifactId>
...
So the artifactId of the "child" is basically one level deeper than the artifactId of the "parent".
To create an IntelliJ project from these directories, I've created a "New > Project from Existing Sources", selected the "parent"-Directory and imported it through Maven. Then, I created a "New > Module from Existing Sources", selected the "child"-Directory and imported it through Maven as well. The structure shown in IntelliJ's Project View looks like this:
foo (as a module group)
- child [foo.bar.baz]
- src
- pom.xml
- parent [foo.bar]
- src
- pom.xml
This is exactly as I would expect it to look. But when I close this project and open it again, suddenly the "Project" view looks like this:
foo.bar (as a module group)
- child [foo.bar.baz]
- src
- pom.xml
And the whole "parent"-Module, its POM, and all the other folders within it are simply gone from the "Project" view. There is no way for me to restore it except for
- Removing the "child" from the Project Structure and readding it again, which will fix it until I close and reopen the project, or
- Change the value in the "Name" field of the parent module in the Project structure to something like "foo.bara", upon which IntelliJ will restructure the modules
I have uploaded an archive containing the directories without any IDEA configuration via web form to "intellij-multimodule.zip", so you can test and import them from scratch. I don't know exactly how this is supposed to work, but it simply seems not right to me to hide files from me I have added, especially since it seems to work at first and then breaks. I have a lot of projects following this naming structure and I really don't want to set them up every time I open them.
Please sign in to leave a comment.
So the problem seems to have been related to IDEA version 2018.3, probably the lower versions, too. While I have updated several times over the past few weeks, I somehow never actually got the 2019.x versions. Now I updated through the JetBrains Toolbox, 2019.1.3 is now installed and I have not been able to reproduce it again. My apologies for reporting a problem in an outdated version.
Okay, I'll take that back, it just happened again with another project. I have recreated that project right after the update to 2019.1.3 to see if I could reproduce the problem, then restarted a few times without the wrong grouping happening and now, randomly, the Project Structure changed again, so I can now reset everything once again.
Right away, I've tested with my sample project and it is broken, too.
As this is undescribably annoying, how can I prevent IntelliJ from restructuring things at random without asking me? I don't want it to do things without my consent, especially not hiding my own code from me.
Some additional information, here are screenshots I have just taken from the sample project. This is the project structure with the "parent" selected:
This is the "child" selected:
And here is the Project tree:
So where has my "parent" gone?
Sounds like https://youtrack.jetbrains.com/issue/IDEA-197122
Can you check if you have marked ignored modules in Maven -> Ignored Files settings?
Please try also 2019.2 RC version.
Thanks for your response. I've opened the sample project with everything being fine at first. To have a reference, I checked for Ignored Files in Maven and none were ignored.
I then repeatedly opened and closed the project with the problem occuring on the 3rd time opening it. I then checked again for Ignored Files in the Maven settings, but the settings are the same, no files ignored, whether it's broken or not.
Since it broke after the 3rd time opening and closing, I became a bit suspicious, so I've opened and closed it again a few times and it really seems to do this at random. Sometimes, the Project view is fine, sometimes it's broken.
Could you please provide a sample project? For uploading you can use out server (ftp of https interface) or any file sharing service.
I have uploaded a file "intellij-multimodule.zip" via the HTTPS interface, but can't share a link to it. Should I rather use FTP?
Also, I'm installing 2019.2 RC at the moment, to check if the problem still occurs in that version.
I could reproduce the behavior in IDEA 2019.2 EAP Build #IU-192.5728.12 on the second time opening the sample project. Checked Maven > Ignored Files on both occasions, no differences whatsoever.
I also deleted any IDEA-related files from the project to have a clean directory like in the archive I've uploaded, but could reproduce it with the files newly generated by 2019.2, too.
Opening and closing the project repeatedly yields the same results as in IDEA 2019.1 and IDEA 2018.3, with the view changing every now and then.
Thank you. Reproduced with Store generated project files externally option enabled in Maven | Importing. Try disabling it an re-import Maven project. Also try 2019.2 version - it works for me there.
I've disabled the option and re-imported all projects in the Maven sidebar, but the behavior is still the same in both, 2019.1 and 2019.2. With both versions, I again have deleted all IDEA files and did a clean project creation using the steps provided in my original post, checking for the Maven setting in question right after the "parent" was created as new project and before importing the "child" directory as module.
Closing and opening it a few times and again, the "parent" is missing. I also have invalidated caches and restarted IDEA but to no avail, the issue unfortunately persists.
Thank you for information. reported the https://youtrack.jetbrains.com/issue/IDEA-218436. Please follow it for progress. Reproduced the issue with 2019.2 and mentioned option unchecked also. Looks like it is related to modules grouping.
Thank you very much for your assistance and your efforts! And sorry for my initial frustration, I just hope this is something that can be resolved.