How to deploy native binary with Maven module?

  • Replies:1
Priyanka Kota
  • Forum posts: 2

Feb 23, 2021, 12:01:49 PM via Website

Our project consists of a java library and a platform-specific binary. The java library launches the binary as a subprocess on every run. The java library is distributed as a Maven module and we need a way to deploy the binaries too. Ideally we'd like Maven to download the binaries to a local path (e.g. under ~/.m2/repository//) and let us launch from there but it seems that one could only package module as zip/jar files in Maven (there is no packaging option to deploy the binaries as is).

We've considered the following options:

Package the binaries into a jar, distribute the jar as a Maven module and on every run extract the binaries from jar into a temp directory and launch it from there. This is the approach we currently take, it requires extracting the binaries every time and doing cleanup on shutdown which is sub-optimal.

Manage the binary components independently from Maven, i.e. require downloading them separately from the Maven module. This obviously requires more work to properly setup the project and keep the binaries version in sync with the java library.

Is there a better way to distribute such binary component with Maven?

Reply
James Watson
  • Forum posts: 1,584

Feb 24, 2021, 4:23:44 AM via Website

For my Android projects in Android Studio, I prefer to place native libraries(shared libraries, .so files) in a jniLibs folder. Just for your reference.

— modified on Feb 24, 2021, 5:17:09 AM

Download size < 0.15 MB. But also accurate enough, ad-free & free.
The minimalist app available on Play Store: https://goo.gl/ws42fN
Blog: https://okblackcafe.blogspot.com Your 5-star is appreciated.

Helpful?
Priyanka Kota
Reply