Issue
I have a Kotlin library that I want to publish to Maven repository and use in other applications.
But when I add it as dependency (to pom.xml
) in my Kotlin app I get this warning:
[WARNING] Some JAR files in the classpath have the Kotlin Runtime library bundled into them.
This may cause difficult to debug problems if there's a different version of the
Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath
or use '-Xskip-runtime-version-check' to suppress this warning
[WARNING] .........mylib.jar: (-1, -1) Library has Kotlin runtime bundled into it
What does it mean? Do I need to somehow exclude kotlin-stdlib
from my library JAR? But what if I also want to use it in Java app?
Solution
Turns out it was just an issue specific to my library project.
I was using maven-shade-plugin
to generate a "fat" JAR (containing all dependencies) which replaced the original JAR (so I deployed JAR with all dependencies bundled instead of just the library itself and list of dependencies) because it was also intended to be used as a simple console application.
So the solution is either to move the app to a separate project or to keep the original JAR (using <shadedArtifactAttached>
+ <shadedClassifierName>
in the plugin configuration) and/or disable this plugin during deployment using Maven profiles as described here https://stackoverflow.com/a/39558669/964478.
Answered By - Alex P.