javamavenjava-native-interfacemaven-nar-plugin

How do I add a NAR dependency to a maven pom file?


I'm trying to use JNI, and I'm using the maven-nar-plugin to package up the C++ code into a NAR. Now, I want to include this code in another Java project. How do I go about doing this properly?


Solution

  • It depends on how you want to use the dependencies created by maven nar plugin. From the documentation,

    Other maven projects may specify dependencies on these nar files using the standard maven dependency declaration. Nar files get downloaded, unpacked and installed in the local maven repository, just like jar files are (apart from the unpacking).

    The FAQ has a section on how to load the native library from java code.

    Hope these help.