title: Using maven to build/deploy/use projects with JNI
body: <p>I am trying to use maven to build a project that depends on a JNI wrapper around the OpenCV computer vision library.  I've been able to "maven-ize" the OpenCV wrapper here: <a href="http://ubaa.net/shared/processing/opencv/" rel="nofollow noreferrer">http://ubaa.net/shared/processing/opencv/</a> by using FreeHEP's NAR maven plugin, but the documentation for that plugin is somewhat lacking.  </p>
  
  <p>I've been able to create a project (imagedetect) that depends on the OpenCV jni project (I'm calling that OpenCVJava). imagedetect will compile, however, any test, integration-test, or package target fails with an error about libraries missing from the java.library.path.  </p>
  
  <pre><code>!!! required library not found : no OpenCV in java.library.path
  Verify that the java.library.path property is correctly set and 'libcxcore.so', 'libcv.so', 'libcvaux.so', 'libml.so', and 'libhighgui.so' are placed (or linked) in one of your system shared libraries folder
  </code></pre>
  
  <p>This is particularly frustrating -- the only way I know to resolve this is to somehow track down the .nar file for the opencv libraries, manually extract them, set the java.library.path, and then invoke the gnaraly java command to actually execute the tests/application with the proper classpath / library path.  This isn't going to work--particularly if this problem persists to transitive dependencies.  </p>
  
  <p>How can I make this build/test/execute system cleaner?  I'm not set on FreeHEP, but I would like to stick with maven, since it makes our most common use-cases much simpler.</p>
  
  <p>FreeHEP Nar plugin: <a href="http://java.freehep.org/freehep-nar-plugin/intro.html" rel="nofollow noreferrer">http://java.freehep.org/freehep-nar-plugin/intro.html</a></p>