简体   繁体   中英

Kotlin DSL adding Kotlin SourceSets doesn't affect

I am adding Kotlin SourceSets to my project but I am unable to see Kotlin source in the Project layout .

What I have in build.gradle.kts

sourceSets {
    getByName("main").java.srcDirs("src/main/kotlin")
}

What I see in the project path

在此处输入图片说明

And also when I run ./gradlew sourcesets task I see 2 sources for the module.

在此处输入图片说明

I googled it but couldn't find useful info. How can I have kotlin instead of java ? Thanks.

Okay, It is too simple to do so. Just delete java source and create a new directory called kotlin inside main . Everything will be done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM