grails / grails-gradle-plugin-archived

141 stars 40 forks source link

web and spring facets are not added to the grails/gradle project #66

Open nanandn opened 10 years ago

nanandn commented 10 years ago

With intellij 13 and the the latest version of the plugin, the source and test paths are set. But web and spring module configurations are not added.

johnrengelman commented 10 years ago

AFAICT, these facets can only be configured if you call the gradle idea task and then open the resulting .ipr file. This should be adding the facets so give that a try. However, when you do this, IntelliJ will not link the project as a Gradle project.

Using IntelliJ's Gradle support, we cannot currently add the facet information because it is not exposed through the Gradle Tooling API, nor does IntelliJ try to acquire it from Gradle.

nanandn commented 10 years ago

Interesting... When I asked the intellij guys the same question, they said that plugin needs to handle it and their gradle tooling API has support for it. I am not able to find the email thread right now. I'll try to dig it up.

johnrengelman commented 10 years ago

Hmmm. Well, if you find some more information, I'll definitely look into it further. I've never really found good documentation on the IntelliJ's internals, so I generally try to decipher their code.

johnrengelman commented 10 years ago

Again, they might mean that it can be added by generating the .iml files directory from Gradle. But starting with IntelliJ 13, there's better integration for just importing the build.gradle file, which doesn't ask Gradle to create the .iml, it calls into the Tooling API in Gradle and then builds the model itself. And I don't see anything in the Tooling API that would include facet information.

nanandn commented 10 years ago

Here is the related discussion I had in the intellij forum. Maybe they are suggesting the same thing you said. http://devnet.jetbrains.com/thread/450994?tstart=0

johnrengelman commented 10 years ago

Right. This is the code in IDEA that integrates with Gradle projects: https://github.com/JetBrains/intellij-community/blob/3d0b01ad2a3bd3232143f495fa62edd115fde7de/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java#L216

If you look at the corresponding object in Gradle's code: https://github.com/gradle/gradle/blob/master/subprojects/tooling-api/src/main/java/org/gradle/tooling/model/idea/IdeaProject.java you'll see that the Tooling API model classes don't have a mechanism for transferring facet information. This could be added, but would require changes to both Gradle core and IDEA and this plugin.

johnrengelman commented 10 years ago

Even some more digging, this appears to be how they support the War facet: https://github.com/JetBrains/intellij-community/blob/043c3e9e7638ca3b31d2720be3c62424de8a70e5/plugins/gradle/tooling-extension-v1.9/src/org/jetbrains/plugins/gradle/tooling/v1_9/builder/WarModelBuilderImpl.java

Basically they detect if there is a War task and then create the facet based on that. They do the same for Scala. So, actually, IDEA could add support for the Grails facet by looking to see if there are any GrailsTask tasks in the project and then configure them (no changes on Gradle core).

nanandn commented 10 years ago

Is there any way you can work with the idea team to get this done? You understand the problem better.

johnrengelman commented 10 years ago

That's not going to be very high on my list. I feel like there is sufficient support in IDEA by just treating it as a gradle project and not trying to get it to look like a Grails project. Plus, everything will change with Grails 3 (still a ways off, but need to consider it).

If you want to post to something on their bug tracker that points to this thread, go for it.

nanandn commented 10 years ago

I opened an issue with intellij earlier, they closed it. I have added comment including this link. Here is the ticket - http://youtrack.jetbrains.com/issue/IDEA-116815 Can you take a look at the mention about the gradle war plugin?