Skip to content

Commit d1efd42

Browse files
committed
Docs: Describe Gradle usage
Closes: #652 Related: #627
1 parent 89dc78c commit d1efd42

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

java/README.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,43 @@
22

33
## Installation
44

5-
```xml
6-
<dependency>
7-
<groupId>cloud.unum</groupId>
8-
<artifactId>usearch</artifactId>
9-
<version>2.20.0</version>
10-
</dependency>
11-
```
5+
For the most up-to-date version, automatically download from GitHub releases and build with Gradle:
126

13-
Add that snippet to your `pom.xml` and hit `mvn install`.
7+
```groovy
8+
repositories {
9+
mavenCentral()
10+
11+
// Custom repository for USearch JAR
12+
flatDir {
13+
dirs 'lib'
14+
}
15+
}
16+
17+
// Task to download USearch JAR from GitHub releases
18+
task downloadUSearchJar {
19+
doLast {
20+
def usearchVersion = '2.20.0'
21+
def usearchUrl = "https://github.com/unum-cloud/usearch/releases/download/v${usearchVersion}/usearch-${usearchVersion}.jar"
22+
def usearchFile = file("lib/usearch-${usearchVersion}.jar")
23+
24+
usearchFile.parentFile.mkdirs()
25+
if (!usearchFile.exists()) {
26+
new URL(usearchUrl).withInputStream { i ->
27+
usearchFile.withOutputStream { it << i }
28+
}
29+
println "Downloaded USearch JAR: ${usearchFile.name}"
30+
}
31+
}
32+
}
33+
34+
// Make compilation depend on downloading USearch
35+
compileJava.dependsOn downloadUSearchJar
36+
37+
dependencies {
38+
// USearch JAR from local lib directory (downloaded automatically)
39+
implementation name: 'usearch', version: '2.20.0', ext: 'jar'
40+
}
41+
```
1442

1543
## Quickstart
1644

0 commit comments

Comments
 (0)