Friday, October 12, 2018

If IntelliJ mysteriously can't find a package, force a Gradle resync

I'm a course developer for an introductory CS class that uses Java in IntelliJ with the Gradle build system. A semi-common problem students encounter is that the IDE sometimes decides that it can't find the test framework package, so the test suite can't be run. Invalidating IDE caches with Invalidate Caches / Restart doesn't always work. What I have found that works is...

  1. Open the build.gradle file
  2. Type some nonsense into it so that the "sync now" notification appears
  3. Press "sync now" - this should fail due to the nonsense
  4. Delete the nonsense
  5. Try the sync again - this should refresh everything

No comments:

Post a Comment