From 340e128a1d190e211606096151a6e9e08fabf13a Mon Sep 17 00:00:00 2001
From: Naveen Singh <36371707+naveensingh@users.noreply.github.com>
Date: Thu, 1 Jan 2026 00:26:35 +0530
Subject: [PATCH] docs: add instructions for building locally
Closes https://github.com/FossifyOrg/General-Discussion/issues/285
---
README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 45 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index fc62922d6..65aa70fee 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,46 @@
# Commons
-Some helper functions, dialogs etc used by multiple Fossify apps.
-For reporting bugs/features that affect multiple apps please use the General Discussion repository.
+Some helper functions, dialogs, etc. used by multiple Fossify apps.
+For reporting bugs/features that affect multiple apps, please use the General Discussion repository.
+
+## Local development
+
+### Publishing to local Maven repository
+
+To publish this library to your local Maven repository (`~/.m2/repository`), use:
+
+```bash
+# Publish with a custom version
+./gradlew -PVERSION=1.2.3 publishToMavenLocal
+
+# Publish with git commit hash as version
+./gradlew -PVERSION=$(git rev-parse --short HEAD) publishToMavenLocal
+```
+
+The version can also be set via `VERSION` environment variable.
+
+### Using locally published build in other apps
+
+1. **Ensure `mavenLocal()` is in the app's repositories** (`settings.gradle.kts`):
+
+ ```kotlin
+ dependencyResolutionManagement {
+ repositories {
+ mavenCentral()
+ google()
+ maven { setUrl("https://jitpack.io") }
+ mavenLocal() // already exists in Fossify app repos
+ }
+ }
+ ```
+
+2. **Update the commons version** in the app's `gradle/libs.versions.toml`:
+
+ ```toml
+ [versions]
+ commons = "1.2.3" # Use the version you published
+ ```
+
+3. **Sync and build.**
+
+> [!TIP]
+> Gradle resolves dependencies in repository order. Since `mavenLocal()` is listed last, it will only be used if the version isn't found in other repositories. To force using local, use a unique version like `1.2.3-local` or a git commit hash.