--- Maven NAR Plugin --- --- Mark Donszelmann --- Usage The following fragments can be used to execute the NAR plugin to compile and link native code. * Create a Shared Library (but not a JNI library). +-- ... nar ... maven-nar-plugin nar-version-number true +-- * Create a JNI Library +-- ... nar ... maven-nar-plugin true jni com.mycompany.mypackage +-- * Create a JNI Library without linking to C++ It is possible to write your JNI code in C++, use the C++ compiler to compile it and then link it only with the C library (as long as you have not used any C++ library calls). Note the two tags to disable exceptions and not link with C++. +-- ... nar ... maven-nar-plugin true false jni false +-- * Create a JNI Library using SWIG generated code Since SWIG already generated the .h file normally generated by javah, we exclude this file from javah. We also include the compilation and linking with java. The example also shows how to configure the {{{http://duns.github.com/maven-swig-plugin/}maven-swig-plugin}}. +-- ... nar ... maven-swig-plugin swig generate true org.domain.packagename Module.swg ... maven-nar-plugin true +-- * Assemble libraries made on different platforms for distribution This example shows how to download, unpack and assemble the already deployed machine dependent libraries. It also shows the setup of the standard maven-assembly-plugin to pick up the unpacked libraries. Note there is no "nar" packaging as the normal packaging for assemblies would be "pom". +-- ... pom ... maven-assembly-plugin 2.0.1 ... src/main/assembly/x86-Windows-msvc.xml src/main/assembly/ppc-MacOSX-g++.xml src/main/assembly/i386-Linux-g++.xml ... maven-nar-plugin x86-Windows-msvc ppc-MacOSX-g++ i386-Linux-g++ nar-download nar-unpack nar-assembly +-- The i386-Linux-g++ assembly descriptor is below: +-- i386-Linux-g++ tar.gz target/nar/lib/i386-Linux-g++/jni lib/i386-Linux-g++ * +--