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?
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.
The third slide in this presentation about the NAR Plugin by Mark Donszelmann of the Stanford Linear Accelerator Center compares the native-maven-plugin and the maven-nar-plugin. Quoting from slide 3, the pros and cons of the native-maven-plugin:
Pros
- Very configurable
Cons
- Did not run out of the box (no defaults)
- No binary dependencies
- Not cross platform (different profiles for different platforms)
I've used a lot native-maven-plugin since one year to cross-compile C and C++ source code (with a profile for each platform options like compiler, compiler options, linker options, etc...). It works like a charm but I feel pretty alone in my situation. Now, I don't understand why C/C++ developper still use make or cmake tools from an other era. Maven is so better for managing versions and dependencies...
精彩评论