-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpom.xml
More file actions
498 lines (476 loc) · 24.3 KB
/
Copy pathpom.xml
File metadata and controls
498 lines (476 loc) · 24.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- NOTE: the groupId is the reversed zvec.org domain, required for the
Sonatype Central namespace verification (TXT record on zvec.org).
The Java package name org.zvec.binding is aligned with the groupId prefix. -->
<groupId>org.zvec</groupId>
<artifactId>zvec-java</artifactId>
<!-- Version tracks the bundled zvec native version (here zvec v0.7.0),
matching the zvec release scheme. Binding-only fixes bump the third
segment (rocksdbjni precedent). -->
<version>0.7.0</version>
<packaging>jar</packaging>
<name>zvec-java</name>
<description>Industrial-grade Java bindings for the Zvec in-process vector database C API (JavaCPP/JNI)</description>
<url>https://github.com/zvec-ai/zvec-java</url>
<organization>
<name>zvec-ai</name>
<url>https://zvec.org</url>
</organization>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/zvec-ai/zvec-java/issues</url>
</issueManagement>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>zvec-java maintainers</name>
<email>zvec@alibaba-inc.com</email>
<organization>zvec-ai</organization>
<organizationUrl>https://github.com/zvec-ai</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/zvec-ai/zvec-java.git</connection>
<developerConnection>scm:git:ssh://git@github.com/zvec-ai/zvec-java.git</developerConnection>
<url>https://github.com/zvec-ai/zvec-java</url>
</scm>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javacpp.version>1.5.11</javacpp.version>
<junit.version>5.10.2</junit.version>
<!-- Location of the Zvec core (git submodule at ./zvec). Override for local
builds that reuse a sibling checkout, e.g. -Dzvec.home=/path/to/zvec -->
<zvec.home>${project.basedir}/zvec</zvec.home>
<zvec.include.path>${zvec.home}/src/include</zvec.include.path>
<zvec.lib.path>${zvec.home}/build/lib</zvec.lib.path>
<!-- cppjieba dictionary bundled with the JAR so the `jieba` FTS
tokenizer works out of the box (mirrors the zvec SDK layout,
which ships the same files under data/jieba_dict). -->
<zvec.jieba.dict.path>${zvec.home}/thirdparty/cppjieba/cppjieba-5.6.7/dict</zvec.jieba.dict.path>
<!-- Auto-detected build platform (e.g. macosx-arm64, linux-x86_64, windows-x86_64) -->
<javacpp.platform>${os.name}-${os.arch}</javacpp.platform>
<!-- Maven Central publishing (release profile): keep manual portal
review by default; CI may pass -Dcentral.autoPublish=true. -->
<central.autoPublish>false</central.autoPublish>
</properties>
<dependencies>
<!--
JavaCPP: JNI code generation + cross-platform native loading.
JavaCPP 1.5.11 is triple-licensed (Apache-2.0 OR GPL-2.0-or-later OR
GPL-2.0-with-classpath-exception). This project uses it under the
Apache-2.0 terms, which is compatible with the project license.
-->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<version>${javacpp.version}</version>
</dependency>
<!--
JUnit 5 for testing. junit-jupiter is the aggregator artifact
(api + engine + params); it is test-scope only and not distributed.
-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<!-- Default resource directory (kept explicit because overriding
<resources> replaces the implicit default). -->
<resource>
<directory>src/main/resources</directory>
</resource>
<!-- Carry the license and attribution notices inside every JAR we
publish (Apache-2.0 4(d): the bundled natives are built from
the zvec submodule, whose NOTICE ours reproduces verbatim).
Declared as a resource rooted at the repository so each file
exists exactly once and stays the source of truth. -->
<resource>
<directory>${project.basedir}</directory>
<targetPath>META-INF</targetPath>
<includes>
<include>LICENSE</include>
<include>NOTICE</include>
</includes>
</resource>
<!-- Bundle the cppjieba dictionary files from the zvec submodule
into the JAR (zvec/jieba_dict/). At runtime Zvec.initialize()
extracts them to a cache directory and registers the dir via
zvec_set_default_jieba_dict_dir(). maven-resources-plugin
silently skips this entry when the directory is absent (e.g.
vendor-mode builds without the submodule). -->
<resource>
<directory>${zvec.jieba.dict.path}</directory>
<targetPath>zvec/jieba_dict</targetPath>
<includes>
<include>jieba.dict.utf8</include>
<include>hmm_model.utf8</include>
</includes>
</resource>
</resources>
<plugins>
<!-- Step 1: pre-compile ONLY the JavaCPP preset config class so the
parser (step 2) can load it as an InfoMapper. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.16.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<id>compile-presets</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<includes>
<include>org/zvec/binding/presets/*.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<!-- JavaCPP: parse c_api.h to generate ZvecNative.java, then generate
and compile the JNI glue library (libjnizvec.*). -->
<plugin>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<version>${javacpp.version}</version>
<configuration>
<includePaths>
<includePath>${zvec.include.path}</includePath>
</includePaths>
<linkPaths>
<linkPath>${zvec.lib.path}</linkPath>
</linkPaths>
<copyLibs>true</copyLibs>
<copyResources>true</copyResources>
</configuration>
<executions>
<!-- 2a. Parser: InfoMapper -> generated ZvecNative.java -->
<execution>
<id>javacpp-parser</id>
<phase>generate-sources</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<classOrPackageNames>
<classOrPackageName>org.zvec.binding.presets.ZvecConfig</classOrPackageName>
</classOrPackageNames>
<outputDirectory>${project.build.sourceDirectory}</outputDirectory>
</configuration>
</execution>
<!-- 2b. Generator + Compiler: ZvecNative -> JNI cpp -> libjnizvec.* -->
<execution>
<id>javacpp-compiler</id>
<phase>process-classes</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<classOrPackageNames>
<classOrPackageName>org.zvec.binding.ZvecNative</classOrPackageName>
</classOrPackageNames>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<!-- The JNI glue (jniZvecNative) and zvec_c_api are bundled under
target/classes/<platform>/ by the javacpp plugin and loaded from
the classpath at runtime; exposing the lib dir also lets the
dynamic linker resolve zvec_c_api (@rpath) during local runs. -->
<argLine>-Djava.library.path=${zvec.lib.path}</argLine>
<environmentVariables>
<DYLD_LIBRARY_PATH>${zvec.lib.path}</DYLD_LIBRARY_PATH>
<LD_LIBRARY_PATH>${zvec.lib.path}</LD_LIBRARY_PATH>
</environmentVariables>
<useModulePath>false</useModulePath>
</configuration>
</plugin>
<!-- Main JAR manifest. The automatic module name is declared
explicitly because the name JPMS would otherwise derive from
the file name is `zvec.java` - legal, but meaningless and at
the mercy of the artifactId. Implementation-* let a consumer
confirm at runtime which coordinates were actually resolved. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>org.zvec.binding</Automatic-Module-Name>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- Style gate, invoked as `mvn checkstyle:check` by the CI `lint`
job. It is intentionally not bound to a lifecycle phase: the
publish pipeline builds inside a manylinux container, and an
extra plugin there is an extra way for a release to fail.
Declaring it here pins the version (an undeclared
`checkstyle:check` resolves whatever the repository metadata
currently calls latest) and supplies the configuration to that
direct goal invocation. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<configLocation>config/checkstyle.xml</configLocation>
<inputEncoding>${project.build.sourceEncoding}</inputEncoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<linkXRef>false</linkXRef>
<!-- Generated by the JavaCPP parser from c_api.h; it has to
stay reproducible, so it is not ours to reformat. -->
<excludes>**/ZvecNative.java</excludes>
</configuration>
</plugin>
<!-- Fat jar (example runner + bundled native libs). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.2</version>
<executions>
<execution>
<id>shade-fat-jar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.zvec.binding.examples.BasicExample</mainClass>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>with-dependencies</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- Maven Central publishing profile: GPG-signed deployment of the
all-platform main JAR plus sources and javadoc JARs (artifact
layout follows org.duckdb:duckdb_jdbc). Activate with:
mvn deploy -Prelease [-,release-natives] -DskipTests
`release` publishes the main (all-platform) JAR plus sources and
javadoc; `release-natives` additionally builds and attaches the
single-platform classifier JARs and the nolib JAR (CI only, it
requires every platform's native library to be staged). -->
<profile>
<id>release</id>
<build>
<plugins>
<!-- The shaded with-dependencies JAR is a convenience for
running the examples; do not ship it to Central. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade-fat-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<!-- The publish pipeline stages every platform's
natives into src/main/resources, and the
jieba dictionary is a resource as well. The
source plugin sweeps resource directories into
-sources.jar too, which would publish ~120 MB
of binaries that are already inside the main
and classifier JARs. A sources JAR should
carry sources. -->
<excludeResources>true</excludeResources>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<doclint>none</doclint>
<quiet>true</quiet>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.8</version>
<configuration>
<!-- Non-interactive passphrase entry for CI. -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<extensions>true</extensions>
<configuration>
<!-- Credentials come from the <server id="central">
entry in settings.xml (CENTRAL_TOKEN_USER /
CENTRAL_TOKEN_PASSWORD in CI). -->
<publishingServerId>central</publishingServerId>
<!-- Keep manual review for now: the bundle stops in
the portal's Deployments page after validation
and is published by clicking "Publish". Flip to
true (or pass -Dcentral.autoPublish=true) once
the pipeline is proven. -->
<autoPublish>${central.autoPublish}</autoPublish>
<waitUntil>validated</waitUntil>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- Extra classifier artifacts (same layout family as
org.duckdb:duckdb_jdbc): one JAR per platform (classes +
jieba dict + that platform's natives only) and a nolib JAR
(classes + dict, no natives). Requires every supported platform's
native bundle to be staged, which is only the case in the
publish-jar CI job; the script fails loudly otherwise. -->
<profile>
<id>release-natives</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.6.3</version>
<executions>
<execution>
<id>package-platform-jars</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bash</executable>
<arguments>
<argument>${project.basedir}/scripts/package-platform-jars.sh</argument>
<argument>${project.version}</argument>
<argument>--require-all</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-platform-jars</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/zvec-java-${project.version}-macosx-arm64.jar</file>
<classifier>macosx-arm64</classifier>
<type>jar</type>
</artifact>
<artifact>
<file>${project.build.directory}/zvec-java-${project.version}-linux-x86_64.jar</file>
<classifier>linux-x86_64</classifier>
<type>jar</type>
</artifact>
<artifact>
<file>${project.build.directory}/zvec-java-${project.version}-linux-arm64.jar</file>
<classifier>linux-arm64</classifier>
<type>jar</type>
</artifact>
<artifact>
<file>${project.build.directory}/zvec-java-${project.version}-windows-x86_64.jar</file>
<classifier>windows-x86_64</classifier>
<type>jar</type>
</artifact>
<artifact>
<file>${project.build.directory}/zvec-java-${project.version}-nolib.jar</file>
<classifier>nolib</classifier>
<type>jar</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>