Saturday 15 March 2014

scala - How can I run tests against jar built by sbt-assembly -



scala - How can I run tests against jar built by sbt-assembly -

i'm running sbt-assembly in order build single jar file can deployed elsewhere. run tests against jar file rather against local .class files. running against local .class files default sbt test want test jar instead (but without incorporating test class files jar).

to build assembly jar in test need configuration

import assemblykeys._ project.inconfig(test)(baseassemblysettings) jarname in (test, assembly) := s"${name.value}-test-${version.value}.jar"

so can prepare uber-jar test:assembly. don't know easy way run tests sbt jar. go custom command, test:run-test-assembly internally

scala -classpath uber-jar-test.jar classpath scalatest-<version>.jar org.scalatest.tools.runner -p compiled_tests

sbt-assembly running tests during assembly phase, i'm pretty sure it's doing agains not yet packaged classes. sou want exclude them assembly phase with

test in (test, assembly) := {}

scala sbt sbt-assembly

No comments:

Post a Comment