IntelliJ forgets maven project after switching branches
Issue reproduction steps:
1. Import a multi-module maven project. Everything is compiling fine at this point.
2. After working happily in the project for some time, a new story comes up, so create a new branch and switch to it.
Result:
IntelliJ forgets this was ever a maven project, and won't compile anymore. No longer does the 'Maven run' option appear in the context menu when I click a module.
Only solution I've found is to close the project and delete all the .idea and .iml files/folders and then reimport it again as a new Maven project.
IntelliJ IDEA 2020.3.4 (Ultimate Edition)
Build #IU-203.8084.24, built on April 27, 2021
Runtime version: 11.0.10+8-b1145.96 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1961M
Cores: 8
Registry: debugger.watches.in.variables=false
Non-Bundled Plugins: VisualVMLauncher, MavenRunHelper, com.jetbrains.php, PlantUML integration
This may be related to this post https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000024670-Intellij-shows-compilation-error-after-switching-branches. It looks similar.
Please sign in to leave a comment.
When you switch the branch - does a new branch have pom.xml files? Are they completely new files? Located in same or different directories?
Please try enabling maven.modules.do.not.ignore.on.delete registry option, see this comment.
The new branch has the same pom files as the old branch, typically.
OK. I'll look into that option.
I don't see that option in the registry.
What IDE version do you use?
You can use Speed Search in dialog to locate the option quickly. Just start typing the registry option name:
IntelliJ updated since I first posted, so now the version is
IntelliJ IDEA 2021.1.1 (Ultimate Edition)
Build #IU-211.7142.45, built on April 30, 2021
Licensed to Wolters Kluwer / April Papajohn
Subscription is active until August 1, 2021.
Runtime version: 11.0.10+9-b1341.41 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1961M
Cores: 8
Registry: debugger.watches.in.variables=false
Non-Bundled Plugins: VisualVMLauncher (1.20.203.4204.0), MavenRunHelper (4.13.203.000.0), com.jetbrains.php (211.7142.45), PlantUML integration (5.3.0)
Kotlin: 211-1.4.32-release-IJ7142.27
Actually, I think the update may have triggered the problem, because I had to redo my project again.
Speed search helped. I turned it on. I'll see if it helps with the problem.