How to add example main class to build.gradle.kts

Although this is more gradle related, this place looks more close to the question I am investigating; therefore posting my question here.

I want to test run examples chatter and pinger, so adding main class below to the build build.gradle.kts. But executing gradle run complains Error: Could not find or load main class ... Caused by: java.lang.ClassNotFoundException: io.libp2p.example.chat.ChatNode or Error: Could not find or load main class ... Caused by: java.lang.ClassNotFoundException: io.libp2p.example.Pinger. It looks like classpath or path problem. How to configure build file so that I can run the example code? Thanks

plugins {
    application 
}
application {
    // mainClassName = "io.libp2p.example.Pinger"
    mainClassName = "io.libp2p.example.chat.ChatNode"
}