Dont include Kotlin-stdlib in jar build

Hi!
Im writing a gradle plugin that automatically does repetitive things for me, like package a jar.
In this case i have a main sourceSet and an extra API one. For the API one i dont want the kotlin stdlib’s in there.
Im packaging it like this:

task.from(apiSourceSet.output)
apiSourceSet.runtimeClasspath.filter { it.name.endsWith("jar") }.map {
    task.from(project.zipTree(it))
}

Now, this automatically includes these:

C:\Users\Sven\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jdk8\1.7.10\d70d7d2c56371f7aa18f32e984e3e2e998fe9081\kotlin-stdlib-jdk8-1.7.10.jar
C:\Users\Sven\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jdk7\1.7.10\1ef73fee66f45d52c67e2aca12fd945dbe0659bf\kotlin-stdlib-jdk7-1.7.10.jar
C:\Users\Sven\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.7.10\d2abf9e77736acc4450dc4a3f707fa2c10f5099d\kotlin-stdlib-1.7.10.jar
C:\Users\Sven\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.7.10\bac80c520d0a9e3f3673bc2658c6ed02ef45a76a\kotlin-stdlib-common-1.7.10.jar
C:\Users\Sven\.gradle\caches\modules-2\files-2.1\org.jetbrains\annotations\13.0\919f0dfe192fb4e063e7dacadee7f8bb9a2672a9\annotations-13.0.jar

I am aware of the project wide setting:

kotlin.stdlib.default.dependency=false

But id like it to only be applied during packaging, not compilation. Is there a good way to filter these out for it? (Since the API jar will not work if its a fat jar with all the kotlin dependencies)

Ive had the idea of filtering out “kotlin-stdlib” in the path, but since annotations also needs to go its a bit harder, since i dont wanna filter out org.jetbrains as a whole.

At the point where i do the task.from(etc) i only get these depdendencies as filepaths, so i cant really ask for group & artifact name either.

Is there maybe a project/Gradle plugin setting i can set for inside my plugin that will remove them from the implementation into compileOnly?
Thanks!