Simón Oroño
Simón Oroño

Reputation: 1090

IDEA showing a project twice in tree

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?

Upvotes: 12

Views: 3407

Answers (2)

jivimberg
jivimberg

Reputation: 890

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

Upvotes: 0

ice1000
ice1000

Reputation: 6579

Open your project structure dialog (you can use Ctrl+Alt+Shift+S), turn to the Modules section, check if you have duplicated module defined there. If there is, remove the unnecessary ones.

Upvotes: 1

Related Questions