Skip to content

Commit ac3acc7

Browse files
authored
IWF-980: [Java SDK] Add instructions for local library testing (#302)
1 parent 30edc26 commit ac3acc7

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@ See more in https://github.com/indeedeng/iwf#what-is-iwf
6767

6868
Run the command `git submodule update --remote --merge` to update IDL to the latest commit
6969

70+
### Local testing
71+
72+
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,
73+
use the local publishing command:
74+
75+
1. Run:
76+
```
77+
./gradlew publishToMavenLocal -x signMavenJavaPublication
78+
```
79+
80+
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:
81+
```
82+
./gradlew --refresh-dependencies build
83+
```
84+
85+
3. Once you're done, to remove the locally published version, run:
86+
```
87+
./gradlew unpublishFromMavenLocal
88+
```
89+
7090
### Repo structure
7191
* `.github/workflows/`: the GithubActions workflows
7292
* `iwf-idl/`: the idl submodule

build.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ compileJava.dependsOn tasks.openApiGenerate
122122

123123
sourceSets.main.java.srcDirs += "$buildDir/generated/src/main/java"
124124

125+
// Custom task to unpublish from local Maven repository
126+
// Usage: ./gradlew unpublishFromMavenLocal
127+
task unpublishFromMavenLocal(type: Delete) {
128+
def groupPath = "io/iworkflow/iwf-java-sdk"
129+
def version = project.version
130+
def m2Repo = "${System.getProperty('user.home')}/.m2/repository"
131+
delete "$m2Repo/$groupPath/$version"
132+
doFirst {
133+
println "Deleting $m2Repo/$groupPath/$version"
134+
}
135+
}
136+
125137
publishing {
126138
publications {
127139
mavenJava(MavenPublication) {
@@ -173,4 +185,4 @@ nexusPublishing {
173185
// password = project.property('myNexusPassword')
174186
}
175187
}
176-
}
188+
}

0 commit comments

Comments
 (0)