Fat jar visibility issue in 1.2.50+

I’ve been trying to build a fat kotlin jar for use by another kotlin project with maven, but every time I’ve tried, the classes/functions in the library have not been visible to the new project. I tried the project here which worked, but even that project has the same issue when I update the kotlin version to 1.2.50 or later. I filed a bug here but was wondering if there was a change in 1.2.50 that I missed that requires some new change to build a fat jar and the mixed-code-hello-world example had just not been updated?

I gave up on fat jars a long time ago and use The Application Plugin instead. Of course, that doesn’t help if you actually need a plain jar.

For me this is just an IntelliJ problem. I can successfully run the project (both in IntelliJ and Gradle) even though IntelliJ can’t find any of my classes that should come from the fat jar.

I’ve tried Kotlin versions 1.3.20 and 1.3.21. I’m not sure what the internals are that keep this from working but I did notice that if the jar is not a fat jar things work correctly.

My use case is that I have a fatjar that contains core dependencies of the application (enough to run the basic parts of the app) while also being able to support plugins with dynamic dependencies.

I’ve tried a few things and none of them worked

  • I’ve tried making the content of folder META-INF of my fat jar the same as the non fat version
  • I’ve tried different versions of gradle.
  • I have tried doing the same thing on an old project’s fat jar of mixed kotlin and java code (Kotlin 1.2.20) with the same version of IntelliJ and class resolution was fine from the IDE.

Also one thing to note is that I’m using the kotlin-platform-jvm plugin. The old code above that worked on Kotlin 1.2.20 was just using the plain kotlin plugin.

Try this: https://youtrack.jetbrains.com/issue/KT-25709#focus=streamItem-27-3320062.0-0