---
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-pluginnar-version-numbertrue
+--
* Create a JNI Library
+--
...
nar
...
maven-nar-plugintruejnicom.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-plugintruefalsejnifalse
+--
* 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-pluginswiggeneratetrueorg.domain.packagename
...
maven-nar-plugintrue
+--
* 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-plugin2.0.1
...
src/main/assembly/x86-Windows-msvc.xmlsrc/main/assembly/ppc-MacOSX-g++.xmlsrc/main/assembly/i386-Linux-g++.xml
...
maven-nar-pluginx86-Windows-msvcppc-MacOSX-g++i386-Linux-g++nar-downloadnar-unpacknar-assembly
+--
The i386-Linux-g++ assembly descriptor is below:
+--
i386-Linux-g++tar.gztarget/nar/lib/i386-Linux-g++/jnilib/i386-Linux-g++*
+--