maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Schuller <>
Subject maven-nar-plugin library loading - how to make use of native libraries opaque
Date Wed, 30 Jun 2010 15:56:40 GMT

I'm not sure I understand the intended usage of maven-nar-plugin, and
after diving around in the source I'm not very much wiser. Given:

* project C (junixsocket in this case) using maven-nar-plugin to build
and deploy jar and nar artifacts
* project B, depending on C
* project A, depending on B

I now want to simply declare that project A depends on B, and not have
to worry about anything else. For example, I still want to be able to
"java -jar XXX.jar" on an uber-jar produced by the maven-shade-plugin
(or assembly, onejar, etc).

I am aware that there are difficulties resulting from the fact that
loadLibrary() cannot load an arbitrary library from a .jar file, and
I'm aware that e.g. jna-posix solves this by unpacking to a temporary
directory and loading the library by absolute path.

With nar-plugin, once problem was that I never was able to make
project A actually depend on the artifact (with the appropriate
platform classifier) other than specifically configuring such a
runtime dependency myself in the pom file. The second problem is that
just making it depend on it won't solve the problem since somewhere,
some code has to exist which jumps through hoops to enable the loading
of the native library during runtime since putting the .nar file on
the CLASSPATH won't make loadLibrary() be able to load the library. I
was unable to find any code that seemed to do this in the nar-plugin,
but perhaps I am missing it.

Based on browsing the source, my current belief is that
maven-nar-plugin is not really intended to address this use-case. Is
that understanding correct, or am I just using it incorrectly?

If nar-plugin is not suitable, does anyone have a suggestion as to a
pre-existing plugin or other solution that is idiomatic/recommended
within the Maven community?

Additionally, if my understanding is correct, I do wonder what people
normally do - i.e., what is the expected usage of nar-plugin in terms
of running a built application (as opposed to developing a project
with maven)?


/ Peter Schuller

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message