[GRADLE-1041] idea plugin for dir-based configuration Created: 19/Jul/10  Updated: 08/Feb/17  Resolved: 08/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 0.9
Fix Version/s: None

Type: Improvement
Reporter: Markus Schlichting Assignee: Unassigned
Resolution: Duplicate Votes: 41

Attachments: Text File GradlePatchIdeaPluginDirectorybasedConfig.patch    



we came across the need to use the directory based configuration of an IDEA for our project.

As we really like the feature of generated module files using the dependencies declared in gradle, I looked into an extension of the idea plugin to write the needed information to the .idea folder instead of the .ipr file.

A first attempt to do so is attached to this ticket as an patch.
There is an new configuration property "useDirConfiguration" to switch between the output modes.
Enabling this option makes the outputFile property useless, as there is only one directory IDEA accepts for its config files

for example:

apply plugin: 'idea'
useDirConfiguration = true

By now the plugin generates only the modules.xml (as this seems to be the only one really needed by idea) and creates/updates the misc.xml file as this is where some of the basic project information is stored.

What do you think of this? Any feedback is appreciated as I'd love to see the support for directory based idea configuration in gradle

thank you

Comment by Hans Dockter [ 29/Jul/10 ]

@Markus I'm very keen to support the directory structure. I did not manage to have a look at this for 0.9. But I will check your patch soon. Many thx.

Comment by Steve Ebersole [ 15/Oct/10 ]

+1 I cannot think of a "need" for it, but I definitely find the directory-based setup much cleaner.

Comment by Etienne Studer [ 02/Mar/11 ]

The .idea project structure is very beneficial for projects that involve multiple users. The .ipr file stores too much user-specific information. With the .idea approach, the .ipr is basically split up into multiple files and only those that are applicable to all users are commited to the repository.

Comment by Johnny Boy [ 14/Nov/11 ]

The .idea project structure has been the default for a long time now.
For a 'new' build system to generate .ipr files seems weird.

Comment by Etienne Studer [ 14/Nov/11 ]

I totally agree. I find this should really make it into 1.0.

Comment by Aleksey Lagoshin [ 07/May/12 ]

Almost two years have passed and Gradle still uses .ipr. Any news on this? All our projects use .idea approach...

Comment by Szczepan Faber [ 08/May/12 ]

We'd like to add support for this however other things turned out more important. Thanks a lot for the reminder!

Comment by Adam Murdoch [ 08/May/12 ]

The native Gradle integration in IDEA uses the .idea directory format, so you might potentially use that as a 'workaround', rather than using the `gradle idea` task. They are both driven from the same model, so you should end up with the same results.

Comment by Luca Cavanna [ 09/May/12 ]

As far as I know with the native Gradle integration in IDEA you still need to reimport the project every time you add or remove a dependency. That's the reason why some people use the idea plugin: to keep the idea configuration in sync with the gradle build files. But it would be better if the plugin worked with .idea files.

Comment by Adam Murdoch [ 09/May/12 ]

There's no question that the plugin should work with .idea files.

The native Gradle integration is improving all the time. For example, in IDEA 11.1 you can resynchronise the dependencies without reimporting the project. And we're working with the jetbrains folks to make this better.

Comment by Steve Ebersole [ 14/May/12 ]

Adam, but it still cannot read projects like Hibernate. And even with 11.1, I have still had trouble getting it to load simpler projects I work on.

Comment by Phill [ 03/Nov/12 ]

IDEA native Gradle integration is still painful - it seems to spend inordinate amounts of time frequently refreshing the gradle dependencies even on the simplest project and does not handle version changes to the dependencies without tedious manual intervention. It also gets in a real mess if the project files are shared via SCM and the artefacts are in different places in the Gradle cache.

Would love to see .idea project support so I can turn off JetGradle in IDEA.

Comment by Andrew Kowal [ 18/Jul/13 ]

Guys, any news on this?

Comment by Adam Murdoch [ 18/Jul/13 ]

@Andrew, not yet. We'd welcome a contribution for this, if you (or anyone else) is interested in helping out.

Comment by Anton Arhipov [ 27/Oct/13 ]

It is actually very easy to workaround. The .idea directory structure requires only modules.xml file that is identical to the *.ipr file that idea plugin generates. So I could just use this simple task to create directory based structure:

  task setup {
     dependsOn ideaModule, ideaProject
     doLast {
       copy {
          from '.'
          into '.idea/'
          include '*.ipr'
          rename { "modules.xml" }
       project.delete "${project.name}.ipr"

The task could be improved to better support the cleanup of the outputs however.

Another option is just use the idea plugin tasks the first time and once project is opened in the IDE, do "File -> Save as directory based project"

However, the plugin could just generate .idea instead of *.ipr by default and just drop *ipr support for good.

Comment by Drew Bailey [ 09/Jul/14 ]

Just wanted to poke this since it's been a while since the last update and has been open for almost four years now (understandably so).

Comment by Sönke Sothmann [ 22/Apr/15 ]

Any progress on this one?

Comment by Marcel Trautwein [ 25/Feb/16 ]

@https://gist.github.com/childnode/12757be70b2895a1eed0 to also catch up the .iws file, but this solution doesn't work. The language level is still not set correctly in IDEa 15. Any ideas?

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 08/Feb/17 ]

The issue is now tracked here: https://github.com/gradle/gradle/issues/1366

Generated at Wed Jun 30 11:45:24 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.