From dd90c87471ef5a10d25435bf28e6f5eca8277dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Cac=CC=A7ador?= <20863811+samuel27m@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:40:40 +0100 Subject: [PATCH 1/2] IWF-980: [Java SDK] Add instructions for local library testing --- README.md | 18 ++++++++++++++++++ build.gradle | 14 +++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b5b946d..7be2e83 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,24 @@ See more in https://github.com/indeedeng/iwf#what-is-iwf Run the command `git submodule update --remote --merge` to update IDL to the latest commit +### Local testing + +If you'd like to test your changes to the SDK with the workflows in the [samples](https://github.com/indeedeng/iwf-java-samples) repo, +use the local publishing command: + +1. Run: + ``` + ./gradlew publishToMavenLocal -x signMavenJavaPublication + ``` +2. In the [samples](https://github.com/indeedeng/iwf-java-samples) repo, make sure your `build.gradle` depends on the same version you just published, then run: + ``` + ./gradlew --refresh-dependencies build + ``` +3. Once you're done, to remove the locally published version, run: + ``` + ./gradlew unpublishFromMavenLocal + ``` + ### Repo structure * `.github/workflows/`: the GithubActions workflows * `iwf-idl/`: the idl submodule diff --git a/build.gradle b/build.gradle index 76a9d74..b274415 100644 --- a/build.gradle +++ b/build.gradle @@ -122,6 +122,18 @@ compileJava.dependsOn tasks.openApiGenerate sourceSets.main.java.srcDirs += "$buildDir/generated/src/main/java" +// Custom task to unpublish from local Maven repository +// Usage: ./gradlew unpublishFromMavenLocal +task unpublishFromMavenLocal(type: Delete) { + def groupPath = "io/iworkflow/iwf-java-sdk" + def version = project.version + def m2Repo = "${System.getProperty('user.home')}/.m2/repository" + delete "$m2Repo/$groupPath/$version" + doFirst { + println "Deleting $m2Repo/$groupPath/$version" + } +} + publishing { publications { mavenJava(MavenPublication) { @@ -173,4 +185,4 @@ nexusPublishing { // password = project.property('myNexusPassword') } } -} +} \ No newline at end of file From 0d6bde82812c2ed056478829c4d11011edf4e4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Cac=CC=A7ador?= <20863811+samuel27m@users.noreply.github.com> Date: Wed, 18 Jun 2025 14:39:46 +0100 Subject: [PATCH 2/2] better readme instructions --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7be2e83..e18ba2e 100644 --- a/README.md +++ b/README.md @@ -76,10 +76,12 @@ use the local publishing command: ``` ./gradlew publishToMavenLocal -x signMavenJavaPublication ``` -2. In the [samples](https://github.com/indeedeng/iwf-java-samples) repo, make sure your `build.gradle` depends on the same version you just published, then run: + +2. In the [samples](https://github.com/indeedeng/iwf-java-samples) repo, make sure your `build.gradle` depends on the same version you just published. To find which version you published, open the SDK's `build.gradle` file and look for the `version = "x.y.z"` line near the bottom of the file. Then run: ``` ./gradlew --refresh-dependencies build ``` + 3. Once you're done, to remove the locally published version, run: ``` ./gradlew unpublishFromMavenLocal