Gradle and IntelliJ IDEA project settings synchronization

We have an excellent news for the Gradle fans today. IntelliJ IDEA 11.1 introduces new features for Gradle integration:

  • ability to compare project structure defined by Gradle and your favorite IDE;
  • ability to solve project structure differences (to some extent);

How does it work? Very simple, a dedicated Gradle window which does everything for you.

First, you need to instruct the IDE what Gradle project you want to sync with (it is linked automatically in case of importing project from Gradle):

Then you get a tree-view that aggregates IntelliJ IDEA and Gradle project structure. It provides a fine-grained visual information for the differences:

Of course it’s possible to customize some representation settings:

That’s cool, but what can we do with that? Currently the Gradle integration offers two actions (more will come later):

  • import Gradle local changes into the IDE;
  • show conflicting settings;

The actions may be performed via node context menu.

It’s possible to filter the tree by Change Type. For example you can observe all local changes of Gradle settings:

The toolbar also contains Refresh action. It builds Gradle-defined project structure information, compares with the one configured at the IDE and shows the changes in the tree.

There is also a bunch of other small features like ability to open target project in the editor , automatic Groovy configuration for the projects imported from Gradle, preserving expand/collapse state for the project structure tree nodes, transitive import, etc.

That’s all for today but we’re going to improve the integration further. Looking forward to hear your feedback, cheers.

New features are already available in the latest IntelliJ IDEA 11.1 EAP build. Don’t forget to submit feature requests and bug reports to the tracker.

image description