You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Roman Kalukiewicz <ro...@borek.sytes.net> on 2006/11/19 00:28:05 UTC
Native libraries handling (SWT)
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
(romkal@borek.sytes.net) as I haven't subscribed to this list.
--
Cheers
Romek Kalukiewicz
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Native libraries handling (SWT)
Posted by AndreasJarund <an...@gmail.com>.
Hi!
Did you ever found a solution to this problem? I would be pleased if you let
me know!
/Andreas
Roman Kalukiewicz wrote:
>
> Hi!
> 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.
>
--
View this message in context: http://www.nabble.com/Native-libraries-handling-%28SWT%29-tp7424790p21437029.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org