I have a Java library project that requires a JNI library to run.  If I
want to use the native:javah goal to create the header file for my JNI
project, the JNI project must list the Java project as a dependency.
The reasons for this are clear.  However, anyone who uses my Java
library as a dependency must also list the JNI library as a dependency.
I'd prefer if the Java library was able to mention the JNI as a
transitive dependency, so when you get my Java library, Maven will pull
the JNI library automatically.  But this would cause a circular
dependency.  

 

Is there any way to accomplish this-make my Java library as easy to use
as possible?  The only thing I came up with was to separate the JNI part
of my Java library into its own project, have the JNI depend on that,
then have my Java project depend on both.  I'd rather do it in less
steps if there's a way.  Even better would be a way to have the Java and
native source in the same (single) Maven project that builds both the
jar and dll/so, but there still wouldn't be a way to tie the multiple
artifacts together.

 

..David..

 

Reply via email to