Gradle Support For Spring Framewokr in Intellij



Is there any similar feature in Intellij IDEA for adding spring framework support through Gradle.

Ex: In Eclipse I can add below entry to make a gradle or spring nature. I'm looking for equivalent in IDEA.


natures "org.springframework.ide.eclipse.core.springnature"
1 comment
Comment actions Permalink


you can do similar using gradle 'idea' plugin, see details at 

apply plugin: 'idea'

idea {
    module {
        iml {
            withXml { xml ->
                def moduleRoot = xml.asNode()            
                def builder = NodeBuilder.newInstance();
                builder.current = moduleRoot;
                builder.component(name: "FacetManager") {
                    facet(type: "Spring", name: "Spring") {
                        configuration {
                            fileset(id: 'fileset1', name: 'XML Application Context') {
                                file 'file://$MODULE_DIR$/src/main/resources/META-INF/spring/applicationContext.xml'

Then, you should run the following task and open generated project in IntelliJ

gradlew idea

Note, IntelliJ builtin Gradle Integration doesn't support such xml manipulations of that 'idea' plugin, because IntelliJ uses gradle tooling API which doesn't provide such data.

That's why you can not use gradle import for such projects and hence features of IntelliJ Gradle integration.

So, maybe better approach can be checking in VCS correct .iml files instead.



Please sign in to leave a comment.