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.

Comments below can no longer be edited.

7 Responses to Gradle and IntelliJ IDEA project settings synchronization

  1. Avatar

    Allen George says:

    March 22, 2012

    Looking forward to trying this out 🙂

  2. Avatar

    Davem says:

    March 27, 2012

    How does one get IntelliJ to apply static typing to the build.gradle file??
    ie: using the groovy editing capabilities of IntelliJ

  3. Avatar

    Denis.Zhdanov says:

    March 28, 2012

    It is expected to work out of the box if the JetGradle plugin is enabled and gradle home is correctly defined

  4. Avatar

    Mark says:

    November 15, 2012

    Love this feature.

    Will you be adding “Enable auto-import” as you do for Maven? If yes, when can we expect this?

  5. Avatar

    Denis.Zhdanov says:

    November 16, 2012

    Yes. We’re planning to improve JetGradle significantly for the v.12.1. It will be possible to manually download and setup the latest plugin version for the IJ 12.0 as well. Keep track of http://confluence.jetbrains.com/display/IDEADEV/News

  6. Avatar

    Artem Navrotskiy says:

    January 2, 2013

    This implementation of integration with Gradle looks very strange: I can add the missing dependencies in the Idea-project, but I can not remove unnecessary (they are displayed, but the easy way to remove them is not).
    I use Gradle as main build tool. And gradle file contains all dependencies. Ideally you need a button to “import dependence of Gradle” (add missing and remove unnecessary).

  7. Avatar

    Denis.Zhdanov says:

    January 2, 2013

    Hi Artem,

    The first problem regarding IDE-local changes is mentioned here – http://youtrack.jetbrains.com/issue/IDEA-83380. The fix can be delivered by manual JetGradle plugin update (http://confluence.jetbrains.com/display/IDEADEV/Gradle+integration#Gradleintegration-Preassembledset%28applicablefortheIJv.12%29).

    We’re also planning to provide number of improvements in project structures management (including ability to sync IDE project structure to gradle) prior to the v.12.1. Feel free to track this page and update the plugin manually as soon as new functionality is provided – http://confluence.jetbrains.com/display/IDEADEV/News

Discover more