tzaenker
tzaenker

Reputation: 61

idea plugin gradle wrong iml file used

Hi I try to setup my intelliJ with gradle.

IntelliJ creates and uses a project.iml in the .idea\modules directory.

When I use gradle with the idea plugin it generates a project.iml in the projects root directory. How can I convince the gradle plugin to use right iml file?

idea {
  module {
    iml {
        withXml {
            println "== IDEA with Xml =="

            def moduleRoot = it.asNode()

            def facetManager = moduleRoot.component.find { component -> component.'@name' == 'FacetManager' }
            if (!facetManager) {
                 println "== new Facet Manager =="
                facetManager = moduleRoot.appendNode('component', [name: 'FacetManager'])
            }

            /*  ----------------------------------------------------------------------------------------------------  */

            def oldSpringFacet = facetManager.facet.find { facet -> facet.'@type' == 'Spring' && facet.'@name' == 'Spring' }
            if (oldSpringFacet){
                println "== Replacing Spring Facet =="
                facetManager.remove oldSpringFacet
            }

            def builder = new NodeBuilder()
            def springFacet = builder.facet(type: 'Spring', name: 'Spring') {
                configuration {
                    fileset(id: 'fileset', name: 'Spring Application Context', removed: 'false') {
                        file('file://$MODULE_DIR$/../../src/main/resources/spring/ApplicationContext.xml'){}
                        file('file://$MODULE_DIR$/../../src/main/resources/spring/local.ApplicationContext.extensions.xml'){}
                        file('file://                        }
                }
            }

            facetManager.append springFacet
...

I use Gradle 3.5 and IntelliJ 2017.1.4

Upvotes: 2

Views: 609

Answers (1)

tzaenker
tzaenker

Reputation: 61

Got this tip in a comment, but the comment disappeared: This article How to import build.gradle into IntelliJ says that the idea plugin is not longer supported. Therefore it is not recommended to use it :-(

Upvotes: 4

Related Questions