Note that there are some explanatory texts on larger screens.

plurals
  1. POPick up native JNI files in Maven test (lwjgl)
    text
    copied!<p>I'm creating a program with LWJGL and Maven, and I'm writing unit tests for the graphical code. My problem is getting Maven to put the native binaries on the classpath so that the tests can pick it up. I can't get past the error:</p> <pre><code>java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path </code></pre> <p>I've gotten the binaries to unpack to target/libs/native/, but the tests won't pick them up.</p> <p>Here's my pom:</p> <pre><code> &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven- 4.0.0.xsd" &gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.ziroby.kata&lt;/groupId&gt; &lt;artifactId&gt;app&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;properties&gt; &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; &lt;lwjgl.version&gt;2.6&lt;/lwjgl.version&gt; &lt;/properties&gt; &lt;repositories&gt; &lt;repository&gt;## Heading ## &lt;id&gt;lwjgl&lt;/id&gt; &lt;name&gt;lwjgl&lt;/name&gt; &lt;url&gt;http://adterrasperaspera.com/lwjgl&lt;/url&gt; &lt;/repository&gt; &lt;/repositories&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.hamcrest&lt;/groupId&gt; &lt;artifactId&gt;hamcrest-library&lt;/artifactId&gt; &lt;version&gt;1.2.1&lt;/version&gt; &lt;type&gt;jar&lt;/type&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.jmock&lt;/groupId&gt; &lt;artifactId&gt;jmock-junit4&lt;/artifactId&gt; &lt;version&gt;2.5.1&lt;/version&gt; &lt;type&gt;jar&lt;/type&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;4.8.2&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.lwjgl&lt;/groupId&gt; &lt;artifactId&gt;lwjgl&lt;/artifactId&gt; &lt;version&gt;${lwjgl.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.lwjgl&lt;/groupId&gt; &lt;artifactId&gt;lwjgl-util&lt;/artifactId&gt; &lt;version&gt;${lwjgl.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.lwjgl&lt;/groupId&gt; &lt;artifactId&gt;lwjgl-native&lt;/artifactId&gt; &lt;version&gt;2.6&lt;/version&gt; &lt;type&gt;pom&lt;/type&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;artifactItems&gt; &lt;artifactItem&gt; &lt;groupId&gt;org.lwjgl&lt;/groupId&gt; &lt;artifactId&gt;lwjgl-native&lt;/artifactId&gt; &lt;version&gt;${lwjgl.version}&lt;/version&gt; &lt;type&gt;jar&lt;/type&gt; &lt;outputDirectory&gt;${project.build.directory}/libs/natives&lt;/outputDirectory&gt; &lt;overWrite&gt;true&lt;/overWrite&gt; &lt;/artifactItem&gt; &lt;/artifactItems&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;unpack&lt;/id&gt; &lt;phase&gt;generate-resources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;unpack&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.2&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>I've tried <a href="https://stackoverflow.com/questions/1324767/maven-add-directory-to-classpath-while-executing-tests">Maven - Add directory to classpath while executing tests</a> , but that seems to be talking about resources, not JNI libraries (and it didn't work).</p> <p>And <a href="https://stackoverflow.com/questions/2677574/specifiy-classpath-for-maven">Specifiy classpath for maven</a> is the opposite problem: Specify things that are already on the classpath.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload