WestCoastProjects
WestCoastProjects

Reputation: 63062

Intellij not showing submodules of multi module maven project

My pom.xml that has been stable for over 24 months is now not working within Intellij - and I can not figure out why it stopped doing so. Here is the modules section:

<modules>
    <module>tcpclient</module>
    <module>tfdma</module>
    <module>tf</module>
    <module>tfspark</module>
    <module>registry</module>
    <module>p2prdd</module>
</modules>

But now the already-existing Run Configurations are no longer working due to not finding classes. I can not even see the modules to try to fix the problem :note that only the Parent module is shown

enter image description here

Note that my next step will be to blow away all the Intellij artifacts such *.iml and .idea/* . But there is a cost to that: e.g. losing my (intricate) run configurations. This is not a preferred solution.

Any ideas why this would have happened?

Upvotes: 11

Views: 15275

Answers (6)

Lycheek1ng
Lycheek1ng

Reputation: 221

The solution works for me is, go to each pom file of submodules, right click, Run Maven -> Reimport (and this could take a while).

Upvotes: 1

Ali Behzadian Nejad
Ali Behzadian Nejad

Reputation: 9044

I had the same problem. I was sure that this is something related to IntellijIDEA. So, I investigated a little and found something strange: All my pom.xml files was added to ignored files section in .idea/misc.xml. I just update the file and moved these ignored files to the originalFiles list and save it (while IDEA was open) and problem solved.

Upvotes: 1

grange
grange

Reputation: 657

I know that question is a little older, but I had the same problem again today and might save others some time.

The setup was working nicely and all of a sudden it stopped working in IDEA (but was still working with Maven on command line). Classes from module B were not found in module A anymore, class search didn't work etc. After trying everything else and re-importing module B, submodules B1, B2, ... were not recognized as Maven modules anymore.

What helped in the end was right-clicking on Module B ⇒ Load/Unload modules ⇒ selecting all submodules ⇒ load and a "Reload all Maven project" from Maven tab afterward. Now, everything is fine again. Just took me a couple of hours to get it running...

Upvotes: 1

Deepak Sabhrawal
Deepak Sabhrawal

Reputation: 131

Just check if the pom of submodule is not ignored (strike out) Right click on submodule's pom.xml -> maven -> unignore projects

Upvotes: 11

selman
selman

Reputation: 1325

Go to pom.xml of each module, right click -> add as maven project. This should solve the issue.

Version:2020.2.2

Upvotes: 20

WestCoastProjects
WestCoastProjects

Reputation: 63062

I walked into a workaround: do Import Module from [Maven] Model under Project Structure:

enter image description here

After pointing to one of the half dozen modules and clicking OK then Intellij re-imported all six for me:

enter image description here

So this is bit weird but then not so bad to resolve..

Upvotes: 1

Related Questions