No Gradle Tool Window in IntelliJ IDEA 13?
You can add a gradle.xml
file in your .idea
directory
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$USER_HOME$/.gradle" />
<option name="gradleJvm" value="1.8.0_40" />
</GradleProjectSettings>
</option>
</component>
</project>
This should enable the gradle panel to show up.
Make sure to replace the correct paths above
IntelliJ have certainly had trouble solving this particular problem, but as of 2018.3.6 the solution has certainly gotten better:
- find the
gradle.build
file - right-click on it and select
Import Gradle Project
no idea (badoom tshhhh) why they've decided to do it this way, but it works, the Gradle tool window becomes available, and it has become a gradle project.
TL;DR
As of 2018.3.6:
- In the project tool window locate the
build.gradle
/build.gradle.kts
file - Right click the build file and select Link Gradle Project (or Import Gradle Project in some IntelliJ IDEA versions)
Background
In regards to the OP's question at the time when IDEA 13 was released, the Gradle Plugin was rewritten and improved in IntelliJ IDEA 13. As a result, Gradle based IDEA projects created in previous versions of IntelliJ IDEA needed to be reimported when first opened in IntelliJ IDEA 13.
Post IntelliJ IDEA 13, sometimes the Gradle Tool window will disappear if the IntelliJ IDEA Project gets out of sync or its configuration gets corrupted.
The Fix
IntelliJ IDEA 2018.3.6 or Later
The quick fix
- Find and select the
build.gradle
/build.gradle.kts
file in the Project tool window - Open the context menu (i.e. right click) and select Link Gradle Project or Import Gradle Project in some versions. (I'm not sure in which version the menu item name got changed.)
NOTE 1: If the context menu option is not available, then that typically means the Gradle Plugin got disabled or uninstalled. Go to Settings/Preferences > Plugins and enable or install the JetBrains Gradle plugin.
NOTE 2: If the gradle build can not be completed successfully, IntelliJ IDEA may not be able to sync to it properly. In such cases, you will likely need to get the gradle build working first.
When the Quick Fix does not work
While the above "Quick Fix" should work most of the time, if it does not work, you may need to:
- If not already done, try the above "Quick Fix". Proceed if that does not resolve the issue.
- Invalidate your caches via File > Invalidate Caches.
- Restart IntelliJ IDEA.
- Wait for the project to get re-indexed. (Watch the progress on right side of the bottom Status Bar of the IntelliJ IDEA window.)
- If the Gradle window does not show after indexing finishes, run the steps in the above "Quick Fix".
- The above steps should solve the issue in almost all cases. If not, close the project in IntelliJ IDEA. In the system, look for the
gradle.xml
file in the project's.idea
directory. Delete or rename it. (If you have gotten to this point, it is most likely this file has been corrupted and we want IntelliJ IDEA to recreate it.) Then reopen the project in IntelliJ IDEA and run the quick fix.
IntelliJ IDEA Pre version 2018.3.6
First, see if the tool window can be opened via View > Tool Windows > Gradle. If so, the gradle project is configured and ready to use. If not, you will need to re-import the project as discussed below.
While your project settings should be maintained, it would be prudent to backup the .idea
directory prior to doing the re-import. Go to File > Import Project (or File > New > Project from Existing Sources in newer IntelliJ versions), select and import your *.gradle
file. You can choose "This Window" when prompted as to what window to open the project in. You will then have the Gradle
window (renamed from JetGradle
) and gradle functionality. All your previous project settings should remain intact. If not, close the project and do a diff of the backed-up and current .idea
directories.
For some versions of IDEA, the above may not work if done with the project opened. Instead, you will need to close the project, and do the import from the Welcome Screen or another project. This also holds true if the project was never a gradle project and you want to add gradle functionality/backing.