I have a kotlin multiplatform shared library, whic...
# multiplatform
g
I have a kotlin multiplatform shared library, which i want to share with someone, without publishing it into maven, what are my options? Ideally, i would like to have a single jar? file, that can be just added using "implementation(files("mymodule.jar"))", is it something that is possible?
a
there's a Gradle plugin that will let you add a dependency via git https://melix.github.io/includegit-gradle-plugin/latest/index.html
g
I don't want to share the source
c
If the modules you want to share has dependencies, you will need to create a “fat jar” for it, so that it embeds all of the dependencies into a single jar. However, this will mean that any public class in any of those dependencies will now be visible to your consumer, since there’s no metadata to inform gradle of what is
api
and what is
implementation
.
e
that doesn't work for multiplatform
the Gradle module metadata is necessary
c
Even if you wanted to publish a
jvm
target?
e
if your only target is JVM, the JVM JAR will work, but not the main artifact as published by the Kotlin multiplatform plugin
👍 2
you can use a local directory as a Maven repository and share that
👀 1
a
You can publish to a directory, zip the contents of the directory and send them to your friend, let him extract that zip and add it as a maven coordinate, that will work too. And it is way better than the fatjar approach
e
better than mavenLocal too
💯 1