Is there a plan to update the gradle idea plugin to support IDEA 13?
The beta is out for the next version, but when I run my gradle idea task and then open that project in IDEA, I get the error “Module X is not backed by gradle” when I try to run a gradle task. (IDEA 12 would just prompt you to configure gradle if you hadn’t already and then would execute the gradle task).
Are there plans to support the new version of IDEA, or is the plan that we should now be using the IDEA import functionality? The IDEA gradle import doesn’t work for me either - but I’d prefer to use the idea plugin anyway. I’d like to know in which direction I should be focusing my efforts - I don’t want to try and figure out how to fix the idea plugin for IDEA 13 only to be told “we’re not supporting the plugin with IDEA 13, just use the IDEA import feature”.
I’ve seen the same problem with recent versions of IntelliJ. Hopefully it’s something minor, and they didn’t retire the file-based configuration format or something.
Using Gradle 1.9 and IntelliJ 13 (the final releases of each, not a release candidate) I can use Gradle with Intellij. To do so, I had to run ‘gradle cleanIdea’ then import the project to Intellij and it was detected as a gradle project.
I’m noticing that there are some issues with using Gradle 1.9 with Intellij 13… as far as I can tell they only appear when old bits of old configurations (from Intellij 12, Netbeans, or Gradle 1.8) are lying around. In order to get things working I did the following.
Careful if you follow these steps… consider moving the files instead of deleting them if you don’t know whether you need them. I know I didn’t need them for anything and they are automatically recreated by gradle or the ide.
gradle clean cleanIdea
rm -rf .idea
rm -f *.iml
rm -rf .gradle
rm -rf build # was necessary for me, but probably not for you
rm -f build.xml # left over Netbeans auto generated build
rm -rf nbproject
./gradlew idea
Then I opened Intellij and opened the project (I didn’t import, I opened).
I followed Jasons post, but I am running under Windows. So I did (Gradle 1.9, IDEA 13 community edition):
run ‘gradlew clean cleanIdea’
deleted
Directory ‘.gradle’
Directory ‘.idea’
Directory ‘out’
File ‘.iws’
run ‘gradlew idea’
Unfortunately this did not work (at least under Windows). The opened project was not detected as gradle project. In this post it is told that there is no backward compatibility with IntelliJ 12 gradle projects at the moment.
From what I know, the IDEA project file format changed incompatibly in IDEA 13, and Gradle’s ‘idea’ plugin may have to catch up with that. In any case, the preferred way of integrating with IDEA 13 is to use IDEA’s Gradle import, without running ‘gradle idea’. (You should still apply the ‘idea’ plugin though, and it’s still important to apply it to ‘allprojects {}’ rather than ‘subprojects {}’ when dealing with multi-project builds.)
May I ask why the Gradle idea plugin is necessary when IDEA is importing the gradle project? In my understanding no task from the plugin is called, so why has it to be there?
The ‘idea’ plugin provides the object model that IDEA queries via the Gradle tooling API. By tweaking that model, you can control the IDEA setup right from your build scripts, even if you aren’t generating IDEA project files anymore.
That said, if you are happy with all the defaults and have nothing to configure, it may be possible to omit applying the plugin. Haven’t tried that yet.
Thanks for clarification. This means that even if the IDE generated the project I am able to cusomize the project file generation like described here by mrhaki.
So the only thing that is left is when I am using IDEA13 I will overwrite the task idea with:
task idea(overwrite: true) {
println ‘IDEA project generation should be triggererd from IDEA via “Import project…”’