javamavenjava-native-interfacemaven-nar-pluginnative-maven-plugin

maven-nar-plugin vs native-maven-plugin, which is better?


I am going to create a java project that uses JNI. I want to deploy the project as a stand-alone application, but some modules might be used as libraries of other applications as well. I want to support different platforms and everything should be as painless as possible.

As far as I can see, I have the choice between the maven-nar-plugin, which wasn't updated for one and a half year now, and the native-maven-plugin, which seems less user friendly to me.

Do you have any experiences with one of them or recommendations which I should use?


Solution

  • I've only used the maven-nar-plugin for standalone C/C++ apps, but it's worked very well for that.

    As for JNI, I've been using the native-maven-plugin for a few years now on a sizable application. We use it to allow our Java apps to interface with other applications that only offer C APIs. I've actually found it pretty user-friendly. The documentation is pretty good and explains basic usage, but you still have to deal with the C compiler and linker and whatever options that are required for building.

    We just pass it the compiler and linker commands and options, the source location, and the javah file locations and it works. I have to say that with all of the pain we've been through with JNI, the maven plugin is one of the few things that hasn't been a big hassle.