Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Gradle Goodness: Create a Shortcut Key to Refresh Gradle Projects in IntelliJ IDEA

DZone's Guide to

Gradle Goodness: Create a Shortcut Key to Refresh Gradle Projects in IntelliJ IDEA

Let's see how to map IntelliJ IDEA's ''Refresh All Gradle Projects'' button to a keyboard shortcut so your hands can remain on the keyboard.

· Java Zone ·
Free Resource

Build vs Buy a Data Quality Solution: Which is Best for You? Gain insights on a hybrid approach. Download white paper now!

We can open a Gradle project in IntelliJ IDEA and get support for Gradle inside IntelliJ. Sometimes, we need to refresh the project in IntelliJ IDEA, for example when we add a new dependency or plugin in our Gradle build file. We need to refresh the Gradle project so IntelliJ IDEA can work with the changes. The Gradle tool window has an icon to Refresh all Gradle projects. But this means a mouse action and we want to have a shortcut key so we can leave our hands on the keyboard.

The action Refresh all Gradle projects is actually the action Refresh all external projects. We can add keyboard shortcut key via Preferences | Keymap. We use the search box to search for Refresh all external projects.

Image title

We can right click on the found action and select Add Keyboard Shortcut to define a new shortcut key:

Image title

Now we simply use the shortcut to refresh our Gradle project when we have made a change in the Gradle build file that IntelliJ IDEA should know about.

Besides having the action in the Gradle tool window, we can also add it to the main toolbar. We right click on the main toolbar and select the option Customize Menus and Toolbars.... We can add the action Refresh all external projects here to the toolbar:

Image title


Written with Gradle 3.4.1 and IntelliJ IDEA 2016.3.4.



Build vs Buy a Data Quality Solution: Which is Best for You? Maintaining high quality data is essential for operational efficiency, meaningful analytics and good long-term customer relationships. But, when dealing with multiple sources of data, data quality becomes complex, so you need to know when you should build a custom data quality tools effort over canned solutions. Download our whitepaper for more insights into a hybrid approach.

Topics:
intellij idea ,gradle ,keyboard shortcuts ,java ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}