Gradle project won't sync after change to settings.gradle

Answered

We have a multi-module project that we have recently converted to Gradle and a few members of our development team have had the problem that the set of modules that IntelliJ knows about somehow gets "stuck" and refuses to update after a change to the settings.gradle file.  This is what we have tried:

  1. Shut down IntelliJ
  2. Remove the .idea/modules.xml
  3. Remove the .idea/modules directory
  4. Revert the .idea/gradle.xml file to a minimal file
  5. Start up IntelliJ
  6. Open the Gradle window
  7. Do the Sync operation in that window

I had thought (and have experienced) that steps 1-4 will put you back into a state where IntelliJ can start from scratch and will generate a new modules.xml and the corresponding .idea/modules directories when you sync from the Gradle window.  But for the folks who encounter this problem, when IntelliJ is started at step 5 the Gradle window has a listing of their previous set of modules (corresponding to some previous revision of the settings.gradle file), and the sync at step 7 has no effect.  (In fact, in one case, it doesn't even write out a new modules.xml file.)

I am not able to reproduce this problem myself, so don't know the steps to get into this state, but can anyone tell me if there are other places where IntelliJ is holding on to the set of Gradle projects, or some other cache or configuration that I'm not taking into account? (We have tried invalidating the cache and restarting Intellij.)   

One member of the team got unstuck by toggling the "Create separate module per source set" setting in the Gradle properties, syncing, and then toggling back and syncing again.  That might work for the others as well, but is surely not the best way to get out of this state.

In all cases where the problem occurs the version of IntelliJ is 2016.3.4. (I am using version 2016.3.2.)

Any suggestions?

Susan

0
4 comments

Check the Gradle and JVM versions used for import, make sure they are the same as do work for you. Check idea.log for errors (https://intellij-support.jetbrains.com/hc/articles/207241085).

0
Avatar
Permanently deleted user

I attach a screenshot of an excerpt from the log file from one developer who just encountered this problem (or a variant of this problem).  The version of Gradle is the same as mine; the JVM is slightly different (I have 1.8.0_40; this developer has 1.8.0_60), but this doesn't look like a JVM issue to me.  

Any thoughts on what this error means or how to get rid of it?  (The developer has since done the changing of the "Create separate module per source set" setting, synced and switched back in order to get into a productive state.)

 

0

Attached error seems to be unrelated to a problem. If you have a reproducible test case, please report at https://youtrack.jetbrains.com/issues/IDEA.

0
Avatar
Permanently deleted user

We have tracked this problem down to a name clash between one of our project names and the IntelliJ module name created from one of the source sets.  That is, we have a project in our build named something like g_test, but we also have a project g that has a test source set, and thus when the "Create separate module per source set" is checked, IntelliJ will attempt to create a .iml file g_test for both g_test itself and the test source set in g.  I have filed an issue with a small repro case: https://youtrack.jetbrains.com/issue/IDEA-168284 

0

Please sign in to leave a comment.