在类型为org.gradle.api.internal.tasks.DefaultSourceSetContainer的SourceSet容器上找不到参数的方法srcDirs() [英] Could not find method srcDirs() for arguments on SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer
问题描述
我正在尝试将我的Kotlin应用程序和Kotlin库集编译为JavaScript。我的工作正常,但是当我尝试运行它时,找不到 kotlin.js
。为了解决这个问题,我尝试将 build.gradle
更改为此示例在GitHub上。
I'm trying to compile my Kotlin app and set of Kotlin libraries to JavaScript. I've got that working well, but when I try to run it, it can't find kotlin.js
. To remedy this, I tried changing my build.gradle
to be more like this example on GitHub.
在我的系统中,我定义了这样的源集:(可以工作,但不输出 kotlin.js
)
In mine, I defined source sets like this: (which works but doesn't output kotlin.js
)
sourceSets {
main {
kotlin {
srcDirs 'src/main/kotlin'
}
}
}
类似于这样:(甚至不会同步)
to something like this: (which doesn't even sync)
sourceSets {
main.kotlin.srcDirs += "src/main/kotlin"
}
这给了我这个错误: p>
which gives me this error:
Could not find method srcDirs() for arguments [lib/Blue-Base/src/main/kotlin] on SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer.
如何解决此错误?我知道一个问题是我不太熟悉Groovy / Gradle,但是我觉得我所做的至少应该同步...
How do I resolve this error? I know one issue is I don't quite grok Groovy/Gradle, but I feel like what I did should at least sync...
这里是有问题的代码和项目的链接: https://github.com/BlueHuskyStudios/Decision-Cruncher/blob/SO/53576840/build.gradle
Here's a link to the code and project in question: https://github.com/BlueHuskyStudios/Decision-Cruncher/blob/SO/53576840/build.gradle
推荐答案
好像您编写的是 srcDirs
而不是 main.kotlin.srcDirs
。
Looks like you have written srcDirs
instead of main.kotlin.srcDirs
.
这篇关于在类型为org.gradle.api.internal.tasks.DefaultSourceSetContainer的SourceSet容器上找不到参数的方法srcDirs()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!