Hi!
I am a newbie in maven world, so maybe my question is very simple, but after
few days of searching a was unable to find an answer.
In common maven repository there are SWT libraries. SWT uses JNI and needs
native libraries to work. Unfortunately in common repository those libraries
are not present.
When I create a SWT based project I have to set dependencies. I want my tests
to start entire application so I can use it. It definitely needs
libswt-gtk-3063.so (as SWT implementation calls
System.loadLibrary("swt-gtk-3063");) in runtime scope (in fact those SWT
libraries should have "compile" dependency against this native library).
I know, that it is not the best test I can write (definitely not a unit one)
but there are situations when you need native libraries to be loaded during
test.
I would like to achieve 2 things:
1. Maven will be able to download native dependency into local repository
(this is easy, and probably works now), but
2. Location of native dependency will be added to LD_LIBRARY_PATH env
variable, so JVM can locate libswt-gtk-3063.so file. Another problem is, that
file has to have exactly such name, as this name is hardcoded in sources.
There is third problem witch luckily doesn't harm SWT case: Changing versions
of native library are accessed by java code by constant library name. This
means, that native library should have the same name in repository regardless
of version OR have to be copied somewhere, and renamed when tests are
started.
The only solution I found is to set LD_LIBRARY_PATH variable in surefire
plugin to directory where native libraries reside. But this violates the main
goal of maven - automatic resolution of dependencies. Moreover I have to
hardcode this path into project files, and download proper files on my own.
Maybe there is some way to solve this problem in a more proper way? Or if
maven cannot handle such situations, then maybe someone has found good ways
of handling this?
Anyway thank you for your response and add my address to CC, please
([EMAIL PROTECTED]) as I haven't subscribed to this list.
--
Cheers
Romek Kalukiewicz
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]