Maven/ivy native library dependencies not satisfied?

90 views
Skip to first unread message

Tobi Delbruck

unread,
Jan 25, 2018, 2:40:12 AM1/25/18
to usb4java
Hi all, we are trying to use ivy (https://ant.apache.org/ivy/) for package management in our netbeans java ant project. The problem we have is that no matter what mixture of packages we specify, we don't get the correct native jar for windows. Our ivy configuration is some combination of the following

       <dependency org="org.usb4java" name="usb4java" rev="1.2.0" />
        <dependency org="org.usb4java" name="usb4java-javax" rev="1.2.0" />
        <!--<dependency org="org.usb4java" name="libusb4java" rev="1.2.0" />-->
Ideally, only the first dependency should be enough to use everything.
   
Building this project from windows, In our lib folder (which is where ivy puts the jars), we get 
   usb4java-1.2.0.jar
   usb4java-javax-1.2.0.jar
but only this single native jar file
    libusb4java-1.2.0-osx-x86_64.jar

On windows, this results in the exception

   org.usb4java.LoaderException: Native library not found in classpath: /org/usb4java/windows-x86_64/libusb-1.0.dll

The maven search for usb4java is http://search.maven.org/#search%7Cga%7C1%7Cusb4java

Could there be something incorrect about the maven POMs or other configuration?
Any suggestions welcome, thank you!

Tobi Delbruck

unread,
Jan 25, 2018, 2:43:33 AM1/25/18
to usb4java
It's quite strange, maybe something about ivy, since the POM for usb4java (see link below) appears to specify all the native library dependencies


 

Tobi Delbruck

unread,
Jan 26, 2018, 1:29:20 AM1/26/18
to usb4java
It seems to be a known problem with maven and ivy

One poster there comments: "the problem must be in the code that translates .pom into ivy.xml."

The solution is to  define the libusb4java dependency as
<dependency org="org.usb4java" name="libusb4java" rev="1.2.0">
           <artifact name="libusb4java" type="jar" ext="jar" m:classifier="osx-x86_64"/>
           <artifact name="libusb4java" type="jar" ext="jar" m:classifier="osx-x86"/>
           <artifact name="libusb4java" type="jar" ext="jar" m:classifier="windows-x86_64"/>
           <artifact name="libusb4java" type="jar" ext="jar" m:classifier="windows-x86"/>
           <artifact name="libusb4java" type="jar" ext="jar" m:classifier="linux-arm"/>
           <artifact name="libusb4java" type="jar" ext="jar" m:classifier="linux-x86_64"/>
           <artifact name="libusb4java" type="jar" ext="jar" m:classifier="linux-x86"/>
       </dependency>
Additionally, the ivy-module definition needs to be modified to be 

<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">


Reply all
Reply to author
Forward
0 new messages