dig*_*doo 6 dependencies intellij-idea multi-project gradle kotlin
我在 IntelliJ IDEA 中有一个多项目 Kotlin 项目。无论是从 IDE 还是从控制台,它都可以正常编译和运行。但是,我的 gradle 文件存在问题:IDEA 抱怨“无法识别的依赖符号”以及其他类型的错误。
这是子项目 build.gradle 文件之一:
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'application'
sourceSets {
main {
java.srcDirs "src/java"
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
test {
useJUnitPlatform()
}
jar.dependsOn test
dependencies {
implementation platform('org.jetbrains.kotlin:kotlin-bom')
// All of the following lines show errors:
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4"
testImplementation "org.jetbrains.kotlin:kotlin-test"
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
}
Run Code Online (Sandbox Code Playgroud)
这很烦人,因为这样我就看不到我使用的库是否已过时。
此外,一些 gradle 任务即使运行良好也无法正确识别:
我不知道为什么outputs,outputDir并且doFirst在上面的屏幕截图中显示为灰色。
我尝试了gradle同步、“使缓存无效并重新启动”、“修复IDE”,甚至重新导入项目,但无济于事。你知道这里发生了什么吗?