From a2ef7b9b87b021a1f4d3300af3767747a59fd96a Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Thu, 7 Aug 2025 17:37:33 +0530 Subject: [PATCH 1/2] [ECO-5383] Fixed build script to enable local maven publish --- CONTRIBUTING.md | 14 ++++++++++++++ build.gradle.kts | 9 ++++++++- live-objects/build.gradle.kts | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f849a3545..f6fa21d16 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,6 +47,20 @@ implementation("io.ably:ably-java:$ABLY_VERSION") { runtimeOnly("io.ably:network-client-okhttp:$ABLY_VERSION") ``` +### Publishing to local Maven repository for Development and Testing +To publish the library to your local Maven repository, you can use the following command: + +```bash +./gradlew publishToMavenLocal +``` +To use the locally published library in your project, you can add the following dependency in your `build.gradle` file: + +```groovy +repositories { + mavenLocal() +} +``` + ### How to Add a New Network Engine To add a new network engine, follow these steps: diff --git a/build.gradle.kts b/build.gradle.kts index 779cab77a..c741178c7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,7 +30,14 @@ subprojects { configure(subprojects) { pluginManager.withPlugin("com.vanniktech.maven.publish") { extensions.configure { - signAllPublications() + // Check if we're running a local publish task + val isLocalPublish = gradle.startParameter.taskNames.any { + it.contains("publishToMavenLocal") || it.contains("ToMavenLocal") + } + + if (!isLocalPublish) { + signAllPublications() + } } } } diff --git a/live-objects/build.gradle.kts b/live-objects/build.gradle.kts index ce6642496..e4219840d 100644 --- a/live-objects/build.gradle.kts +++ b/live-objects/build.gradle.kts @@ -3,6 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat plugins { `java-library` alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.maven.publish) } repositories { From c75fb05759943c5b2c62b9c5eae77eaa31b98ef8 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Fri, 8 Aug 2025 16:50:11 +0530 Subject: [PATCH 2/2] [ECO-5383] Updated contributing guide for publishing specific module with precedence --- CONTRIBUTING.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6fa21d16..04ec04bb4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,19 +47,25 @@ implementation("io.ably:ably-java:$ABLY_VERSION") { runtimeOnly("io.ably:network-client-okhttp:$ABLY_VERSION") ``` -### Publishing to local Maven repository for Development and Testing +### Publishing to local Maven repository for development and testing To publish the library to your local Maven repository, you can use the following command: -```bash -./gradlew publishToMavenLocal -``` -To use the locally published library in your project, you can add the following dependency in your `build.gradle` file: + ./gradlew publishToMavenLocal -```groovy + +Alternatively, to publish only the specific (LiveObjects) module: + + ./gradlew :live-objects:publishToMavenLocal + + +- To use the locally published library in your project, you can add the following dependency in your `build.gradle` file: + +``` repositories { mavenLocal() } ``` +- Note - Place `mavenLocal()` before `mavenCentral()` for resolution precedence. ### How to Add a New Network Engine