When a Kotlin Native library is published (via the...
# kotlin-native
n
When a Kotlin Native library is published (via the publishToMavenLocal Gradle task) locally where are the artifacts stored There is a publications directory with the following structure (has multiple module.json and pom-default.xml files): publications/ ├── kotlinMultiplatform │ ├── module.json │ └── pom-default.xml ├── linux │ ├── module.json │ └── pom-default.xml └── metadata ├── module.json └── pom-default.xml
Also there is a libs directory with the following structure: libs ├── gobject-meta-linux-0.1-SNAPSHOT-sources.jar ├── gobject-meta-metadata-0.1-SNAPSHOT.jar ├── gobject-meta-metadata-0.1-SNAPSHOT-sources.jar └── linux └── main └── gobject-meta-cinterop-gir.klib
Two KLibs have been generated: gobject-meta.klib and gobject-meta-cinterop-gir.klib. Is there a way to create a custom KLib repo, and have Gradle import the KLibs via build.gradle?
s
Look in ~/.m2. You’ll find your lib under there.
👍 1
n
Tried to declare the library as a implementation (eg "org.digienggobject meta0.1-SNAPSHOT") but Gradle doesn't pick it up in the ~/.m2 directory even though it exists.
Ended up copying the contents of the library from ~/.m2 to the libs directory (in the project), and added
maven { url = uri("libs") }
to the repositories block (inside the build file) in order to have Gradle find the library.
m
mavenLocal()
in repositories block does not work? Weird, works for me.
n
Didn't know about the
mavenLocal()
trick. Tried it and it works simple smile .