intellij-idea - IDEA 在树中两次显示一个项目

标签 intellij-idea gradle kotlin

我有一个带有两个 child 的 Gradle 的 Kotlin 项目。每当我尝试在 IDEA 中打开它时,其中一个 child 会在树中显示两次。

Screenshot

在树中,您可以在顶层看到两个项目,grpc 和 grp。问题是 grpc(从顶层)与作为 grp 子级的 grpc 是同一个项目。

这是我的 Gradle 构建文件:

父 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()
    }
} 

gradle.settings 文件:

include ':grpstd', ':grpc'

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"
}

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"
}

为什么该项目显示两次?我该如何预防?

最佳答案

打开你的项目结构对话框(你可以使用Ctrl+Alt+Shift+S),转到Modules部分,检查是否你在那里定义了重复的模块。 如果有,请删除不必要的。

关于intellij-idea - IDEA 在树中两次显示一个项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36156291/

相关文章:

android - 如何跳过 "This project is using version xxx of android gradle plugin, which is incompatible with this version of android studio"对话框?

gradle - Gradle分发任务输出文件不在ZIP的根目录

postgresql - 如何通过 Kotlin Exposed ORM 使用 Postgresql 枚举类型?

spring - 在Spring MongoDB存储库中将$ slice与Kotlin中的@Query一起使用时,注释参数错误

kotlin - 在泛型中使用 Nothing 是一个好习惯吗?

java - Intellij Idea & SVN : How to add all new files on "Commit Directories"?

java.lang.UnsupportedClassVersionError : com/dicoding/javafundamental/basic/Main has been compiled by a more recent version of the Java Runtime

Java Lambda 循环推理

unit-testing - 类路径包含多个 SLF4J 与 Gradle 的绑定(bind)

java - Jersey/JAX-RS 项目中的 Gradle 'Could not resolve all dependencies for configuration'