Reputation: 1863
First, I'll list what version of everything I'm using.
sbt = 0.13.5
scala = 2.11.1
scalatest = 2.2.0
I have a jvmOptions area in my file, where I'm putting a lot of the configuration of the JVM.
lazy val jvmOptions = Seq(
"-server",
"-Djava.rmi.server.hostname=" + java.net.InetAddress.getLocalHost.getHostName,
"-Dhttps.port=9001",
"-Xms256M",
"-Xmx2G",
"-XX:NewRatio=1",
"-Xss1M",
"-XX:ReservedCodeCacheSize=128M",
"-XX:MaxPermSize=256M",
"-XX:+DisableExplicitGC",
"-XX:+UseConcMarkSweepGC",
"-XX:+UseParNewGC",
"-XX:+CMSConcurrentMTEnabled",
"-XX:+CMSIncrementalMode",
"-XX:+CMSIncrementalPacing",
"-XX:CMSIncrementalDutyCycleMin=0",
"-XX:CMSIncrementalDutyCycle=10",
"-XX:+CMSClassUnloadingEnabled",
"-Dcom.sun.management.jmxremote.port=9999",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false",
"-Dlogger.resource=custom-logger-settings.xml",
"-Djava.library.path=" + System.getProperty("java.library.path")
)
This supplied the commonSettings area with the correct forks for the run and test.
lazy val commonSettings = {
Project.defaultSettings ++
ScctPlugin.instrumentSettings ++
net.virtualvoid.sbt.graph.Plugin.graphSettings ++
scalariformSettings ++
customFormatSettings ++
unidocSettings ++
Seq(
version := PROJECT_VERSION,
organization := "com.gensler",
scalaVersion := SCALA_VERSION,
scalacOptions in Compile ++= Seq(
"-unchecked",
"-deprecation",
"-feature"
),
parallelExecution in Test := true,
fork in Test := true,
fork in test := true,
fork in testOnly := true,
javaOptions in run ++= jvmOptions,
javaOptions in test ++= jvmOptions,
javaOptions in testOnly ++= jvmOptions,
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % SCALATEST_VERSION % "test" // test framework
)
)
}
The problem I'm running into is the java.library.path. I have a third-party library that I'm trying to use that is in my system's java.library.path in the .sbtopts file.
-Djava.library.path=/usr/lib/teigha
That is all that resides in my .sbtopts. Given everything that's set up, I am getting an error of UnsatisfiedLinkError.
14:16:49.619 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - Exception thrown while attempting to load Teigha libraries: java.lang.UnsatisfiedLinkError: no TeighaJavaDwg in java.library.path
14:16:49.632 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - Value of LD_LIBRARY_PATH: /home/joshadmin/Workspace/avro-nodejs/avrocpp/lib/
14:16:49.632 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - Value of java.library.path:
14:16:49.633 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - /home/joshadmin/Workspace/avro-nodejs/avrocpp/lib/
14:16:49.633 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - /usr/java/packages/lib/amd64
14:16:49.634 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - /usr/lib/x86_64-linux-gnu/jni
14:16:49.634 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - /lib/x86_64-linux-gnu
14:16:49.635 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - /usr/lib/x86_64-linux-gnu
14:16:49.635 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - /usr/lib/jni
14:16:49.636 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - /lib
14:16:49.636 [pool-1-thread-1] ERROR c.g.t.t.custom.CustomSystemServices - /usr/lib
I don't know if this is because I haven't set something right, or if new versions of SBT and Scalatest are doing something I don't understand.
Upvotes: 0
Views: 605
Reputation: 13749
You should set javaOptions
in Test
configuration and not test
task.
javaOptions in test ++= jvmOptions
should be
javaOptions in Test ++= jvmOptions
Note capital T
.
Upvotes: 2