Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 716
Cephalopod Avatar asked Jul 08 '11 09:07

Cephalopod


3 Answers

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.

like image 76
Jon7 Avatar answered Sep 19 '22 15:09

Jon7


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)
like image 1
buzz3791 Avatar answered Sep 20 '22 15:09

buzz3791


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...

like image 1
clement igonet Avatar answered Sep 19 '22 15:09

clement igonet