Publish fat JAR with platform-specific native libraries to Maven Central
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 领域
- build-system, ci-cd, release
调研方向
首先检查现有的 JNI 和 Maven 构建配置,然后运行 mvn package 以了解当前的 artifact 布局。跟踪如何为列出的四个目标生成 native 库并将其组装到 target/classes 下;完成的标准是单个 Maven Central artifact 能加载匹配的库,并且 release workflow 按照有文档记录的步骤部署它。
由索引模型根据 Issue 内容生成。
描述
Background
datafusion-java provides a JVM binding to DataFusion via JNI. To distribute it through Maven Central, we need a packaging strategy that delivers the compiled Rust native library (.so / .dylib / .dll) alongside the Java classes so that consumers get a working artifact with a single dependency declaration — no separate native install step.
Goal
Publish a single artifact to Maven Central that works out of the box on:
- Linux x86_64
- Linux aarch64
- macOS x86_64
- macOS aarch64
Windows (x86_64) support is desirable but out of scope for the initial release. The design should leave room to add it later without restructuring.
Proposed approach: single fat JAR
Bundle all platform-specific native libraries in one published JAR, organized by OS/arch under a known resource path:
org/apache/datafusion/linux/amd64/libdatafusion_jni.so
org/apache/datafusion/linux/aarch64/libdatafusion_jni.so
org/apache/datafusion/darwin/x86_64/libdatafusion_jni.dylib
org/apache/datafusion/darwin/aarch64/libdatafusion_jni.dylib
At runtime, a loader class detects the current OS/arch, extracts the matching library from the JAR to a temp file, and calls System.load() on the absolute path. A System.loadLibrary() attempt should come first so users can override with a system-installed build.
This mirrors the approach used by Apache DataFusion Comet (referenced only as prior art for fat-JAR packaging — datafusion-java is not otherwise related to Comet or Spark). The alternative — publishing one JAR per platform with Maven classifiers — is also viable but pushes platform selection onto consumers and complicates dependency declarations.
Work items
- Add a native loader class that detects OS/arch, extracts from the resource path, and loads via
System.load(), with aSystem.loadLibrary()fallback. Include temp-file locking to handle concurrent JVMs. - Set up cross-compilation for the four target triples (Linux x86_64, Linux aarch64, macOS x86_64, macOS aarch64). Options: a CI matrix that produces per-arch artifacts, or Docker + OSXCross for cross-platform builds from a single host.
- Wire the build so compiled libraries land at the correct
target/classes/...path beforemvn packageruns. - Add a GitHub Actions release workflow: matrix builds per platform produce native libs as artifacts; a final job assembles them into the resource tree and runs
mvn deploy. - Configure Maven Central / Sonatype publishing: staging repo, GPG signing, POM metadata.
- Document the release process.
Future work
- Windows x86_64 support. The loader OS enum should already account for
.dlland thewin32path segment so this becomes a build-matrix change. Windows complicates temp-file cleanup (can't delete a loaded DLL) — extract to a versioned path and let the OS handle cleanup.
- 主要语言
- Java
- 星标
- 32
- 派生
- 12
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/datafusion-java 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
apache/datafusion-java#116 ·
-
难度 5/5 一周以上 新手友好度 25/100
apache/datafusion-java#112 ·
-
enhancement
难度 5/5 一周以上 新手友好度 42/100
apache/datafusion-java#96 ·
-
enhancement
难度 5/5 一周以上 新手友好度 38/100
apache/datafusion-java#95 ·
-
enhancement
难度 4/5 3-5 天 新手友好度 35/100
apache/datafusion-java#86 · 3 条评论 ·
查看 apache/datafusion-java 的全部 Issue
相似的 Issue
-
bug untriaged
难度 2/5 1-3 小时 新手友好度 84/100
opensearch-project/ml-commons#5094 ·
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
-
emitter:client:csharp feature
难度 2/5 1-3 小时 新手友好度 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
难度 2/5 1-3 小时 新手友好度 78/100
-
bug frontend maui-pilot
难度 2/5 1-3 小时 新手友好度 72/100