"The modules below are not imported from Gradle anymore" every time I edit build.gradle
Every time I add a dependency to my project's build.gradle, IntelliJ notifies me that 2 modules ([projname]-main & [projname]-test) are no longer imported. It then changes my project config in ways I don't understand (which includes adding a module under a long-outdated project name), makes all my run configurations unusable, and gives me about a million cannot-resolve-symbol build errors. I have to do a lot of cleaning up (eg. deleting the new .iml files IntelliJ creates) before I can proceed). I start to sweat every time I need to add a dependency (maybe that's a good thing).
Clearly there's something I don't understand about how IntelliJ generates modules from my build.gradle. The project structure is very simple (a main and a test module, which I set up manually in the project config editor). My build.gradle just applies the java plugin, adds repos, and main & test dependencies.
So two questions:
- can I tell IntelliJ just to leave my project/module config for me to manage?
- if not, can someone point to me the docs explaining how IntelliJ automatically creates modules from build.gradle?
Cheers.
(Btw I have no special reason to think this is EAP-related; I just happen to be using the EAP)
请先登录再写评论。
Hi, could you please provide an example project, and exact steps to reproduce the problem?
Petr, isn't that just a bit lazy? I ask two very specific questions. You completely ignore both. Then you paste in standard support dogma.
No, this isn't a reproducible bug as far as I know. If it was, I would have submitted a Youtrack ticket. I didn't, I asked a question on a help forum instead. And I can't share the project.
I have no reason to think it's a bug at all. It could easily be user error -- I have even stated in the question that I don't understand how IntelliJ relates gradle and its module system.
If, as it appears, you don't want to help a user of this quite expensive (but very excellent) software, then please at least answer the second question and point me to the relevant documentation (which I cannot find). I have never come across a problem I couldn't solve myself with the correct information at hand.
OK so you're not willing to help. Poor practise for an expensive piece of software, but JetBrains is well known for being far better at making software than at supporting or documenting it, so caveat emptor I guess.
Please at least answer this question so I can help myself:
Where is the documentation explaining exactly how IntelliJ's gradle support overrides manual module creation?
Hello.
Regarding your questions please check this article:
https://www.jetbrains.com/help/idea/gradle.html#gradle_source_sets
Also please try unchecking "use separate module per source set" option.
Petr -- OK that explains how IntelliJ creates modules based on build.gradle pretty well. I was able to solve my issue. Thanks.