Search code examples
gradleintellij-idea

How to restore/resynch Gradle inside IntelliJ?


I have been using Intellij 2018.1 and Gradle for a while now without issues. This is the first time I have seen this problem.

I have a Gradle-based Java project that doesn't seem to behave correctly when I edit the build.gradle in IntelliJ. Gradle behaves correctly when I issue commands on the terminal, so I think this is limited to IntelliJ's integration w/ Gradle.

What I'm used to seeing in other projects

  • When I modify the list of compile-time dependencies inside build.gradle, Gradle refreshes and updates the entire dependency graph
  • If it can't find a new dependency that I've added, the refresh/rebuild fails and I see errors inside IntelliJ
  • If the new dependencies are found, I see them show up under the External Libraries section of the Project window/pane on the left-hand side of the editor
  • I also see a Build tab at the bottom that seems to log the rebuild/refresh:

enter image description here

What I'm seeing in this one project

  • When I modify my compile-time dependencies from inside IntelliJ, nothing runs/rebuilds on the screen to indicate I've made any changes
    • I can run Gradle on the command line and see success/failure as appropriate, but nothing is updated in IntelliJ
  • The External Libraries do not update as expected under the Project window
  • Furthermore I don't even see that Build tab:

enter image description here

Any ideas as to what is going wrong and what I can do to restore/fix Gradle for my project?


Solution

  • Your project was probably not imported from Gradle, but created manually in the IDE using the wizard. You can import it again from build.gradle file and overwrite the existing project files.

    Changes are refreshed either manually or automatically depending on your settings.