Could not find method srcDirs() for arguments on SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer

橙三吉。 提交于 2019-12-24 21:05:59

问题


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.

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

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.

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...


Here's a link to the code and project in question: https://github.com/BlueHuskyStudios/Decision-Cruncher/blob/SO/53576840/build.gradle


回答1:


Looks like you have written srcDirs instead of main.kotlin.srcDirs.



来源:https://stackoverflow.com/questions/53576840/could-not-find-method-srcdirs-for-arguments-on-sourceset-container-of-type-org

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!