IDEA showing a project twice in tree

Viewed 2791

I have a Kotlin project with Gradle that has two children. Whenever I try to open it in IDEA, one of the children is shown twice in the tree.

Screenshot

In the tree, you can see two projects at top level, grpc and grp. The issue is that grpc (from top level) is the same project as the grpc that's a children of grp.

Here are my Gradle build files:

The parent gradle.build:

buildscript {
    ext.kotlin_version = '1.0.1'
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
} 

The gradle.settings file:

include ':grpstd', ':grpc'

The grpc gradle.build:

apply plugin: 'antlr'
apply plugin: 'application'
apply plugin: 'kotlin'

mainClassName = 'sron.grpc.MainKt'

compileKotlin.dependsOn generateGrammarSource

generateGrammarSource {
    arguments += ['-package', 'sron.grpc.compiler.internal']
}

dependencies {
    antlr 'org.antlr:antlr4:4.5.2-1'

    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile 'commons-cli:commons-cli:1.3.1'
    compile 'org.ow2.asm:asm:5.0.4'
    compile project(':grpstd')

    testCompile 'junit:junit:4.12'
    testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}

The grpstd gradle.build:

apply plugin: 'kotlin'

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    testCompile 'junit:junit:4.12'
    testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}

Why is that project being shown twice? How can I prevent it?

2 Answers

You may want to try disabling the Create separate module per source set option when importing the Gradle module.

import wizard

So, the full steps are:

  1. Open Modules enter image description here
  2. Remove the gradle module
  3. Re-import the module. On the second page of the import wizard make sure you disable the option: Create separate module per source set
Related