Help with fatjar creation

I have narrowed the fatjar example to a minimal case where it does not work - if the dependency for implementation(“com.google.cloud:google-cloud-pubsub:1.122.2”) is added then java does not find the MainKt class
Without the dependency it works fine
Help please
Code is located https://github.com/jefimm/kotlin-executable-jar/blob/main/build.gradle.kts

Well, you are hitting one of the many reasons why imho fat jars (except if done properly like Spring Boot does it) are an abuse of Java functionality and a very bad practice.
See https://fatjar.net for some quotes against them.

There are many pitfalls of things that can go wrong easily when building such bad-practice fat jars.
Some of them can be worked-around, some are simply impossible to mitigate, like when you need to use a security provider, as that for example requires the jar to be signed with a key approved by Oracle and so on.

The pitfall you are currently stumbling upon is, that one of your transitive dependencies (org.conscrypt:conscrypt-openjdk-uber) is a signed jar.
With the naive approach from the docs that really only works in the most simple cases, all files of the jars are copied together, including the signature information.
But as you manipulated the jar contents, the signature of course became invalid and Java considers the jar as tampered with, so it cannot load the classes from within and does not find your MainKt class.

So while still following that approach from the docs, you would at least need to exclude the signature related files and then wait for the next trap you fall into.

If you really need to build a fat jar, you should at least use the shadow plugin, as it helps to ship some of the pitfalls you might fall into, but not all.

But imho it should be avoided wherever possible to build a bad-practice fat jar.
I would recommend to instead build a proper distributable archive using The Application Plugin which then contains your dependencies unmanipulated, your own code, other things you configured, and generated start scripts that puts everything together properly to run it.

thank you for your help