Exclude Kotlin files from gradle build

Hi!

I want to exclude Kotlin files from a gradle build. As long as the files are .java files everthing works fine but after converting them to Kotlin the files seem not to be ignored anymore. Every excluded java file throws a ClassNotFoundException while the excluded Kotlin files behave like “not excluded”.

I added the following to my build.gradle file

sourceSets {
    main {
        java {
            exclude '**/excludedFiles'
        }
    }
}

I already checked the following links:
First
Second