KMP Shared + jFrog Maven
How to use jFrog with KMP shared logic. Publishing a maven from KMP Shared logic on jFrog repo.
KMP Shared + jFrog Maven
Before start, I’m an iOS app developer and first time Im creating Android maven from KMP Shared code. I am using Apple mac book.
In case you are not ware about KMP, please have look official Kotlin Multiplatform Link.
Now lets start, Please download latest Android studio if you dont have already and Setup for KMP.
Create a new KMP app in Android Studio. Lets gradle sync and complete dependency setup. After syncing we will have following

Created KMP App. build.gradle.kts(Module:shared)
Here we will focus on build.gradle.kts(Module:shared). It contains shared logic for iOS & Android and in this tutorial we will upload this shared logic on jFrog as maven.
jFrog Setup:
Open jFrog start page and choose and signup option (login if you already have an account). Once setup, please select Start Trial (free for 30 days)

Next step edit your hostname and Hosting preference if you want and the select “Try It Now”.

Setting up will take 3–4 minutes. Now envoirenment setup is ready. Signin again (I did use google for signup)

After login, please select “Get Start” and Select “Package Management” and click “GO”

Choose “Gradle” from available package options

Give it a name as for me “kmpsahredlogic” and “Create”

Wait for a moment and we will have success screen as below. From here we can copy artifacts URL (not necessary step).

Clicking on continue will land on “Set Up a Gradle client”.

Clicking “Generate Token and Create Instructions” will open configuration page.

Clicking “Generate Setting” from bottom, we can have username and password from “gradle.properties”. Download it and save for future use.

Now from Left side select “Artifactory” and select “Artifacts”. We can see recentlay added gradle repo in the list. Note thar There is no subtree if select created gradle repo. From here please copy file URL

KMP APP Setup
Navigate to recentlly create KMP app and open build.gradle.kts(module:sahred) and follow steps
Step 1: Add ‘maven-publish’ in plugin block
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
id("maven-publish") // Added
}
Step 2: Inside androidTarget add publish variants. Also comment iOS block.
kotlin {
androidTarget {
publishLibraryVariants("release", "debug") // publish variant
compilations.all {
compileTaskProvider.configure {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
}
}
....
....
....
}
Step 3: Add publish task at bottom of file as below
group = "com.example" // Replace with your group
version = "0.0.1" // Increment if needed
publishing {
publications {
create<MavenPublication>("gpr") {
from(components["kotlin"])
artifactId = "kmpsharedlib"
pom {
name.set("KMP Shared Library")
description.set("A Kotlin Multiplatform shared library")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("gagan.vishal.mishra") // Setup your own
name.set("Gagan vishal mishra") // Setup your own
email.set("gagan5278@gmail.com") // Setup your own
}
}
}
}
}
repositories {
maven {
url = uri("<your file URL>")
credentials {
username = "<user_name>" // please check downloaded gradle.properties
password = "<password>" // please check downloaded gradle.properties
}
}
}
}
Step 4: Open gradle.properties and add maven username and passsword
mavenUsername="<user_name>" // please check downloaded gradle.properties
mavenPassword="<password>" // please check downloaded gradle.properties
Step 5: Open settings.gradle.kts and add below
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") // This will help in restricting unwanted files.
Step 6: Now Sync your gradle files.
Step 7: Open terminal and run publish comman
./gradlew publish
Once Succes, please revisit your repo on jFrog and we can see uploaded Shared code

Wooo.. 🥳 Thats it.we have our shared KMP logic on jFrog.
Now in next, will explain how can we use shared logic in our Android app. Stay tune
메타데이터
- post_id
- 59409a976ca3
- slug
- kmp-shared-jfrog-maven-59409a976ca3
- url
- https://medium.com/@gagan5278/kmp-shared-jfrog-maven-59409a976ca3
- canonical_url
- https://medium.com/@gagan5278/kmp-shared-jfrog-maven-59409a976ca3
- author_url
- https://medium.com/@gagan5278
- status
- ok
- fetched_at
- 2026-06-26 21:52:29