我有一个带有两个 child 的 Gradle 的 Kotlin 项目。每当我尝试在 IDEA 中打开它时,其中一个 child 会在树中显示两次。
在树中,您可以在顶层看到两个项目,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/