scala - NoClassDefFoundError running tests in SBT with scoverage plugin -


i have sbt project structure here: https://orrsella.com/2014/09/24/integration-and-end-to-end-test-configurations-in-sbt-for-scala-java-projects/. includes standard main , test directories , additionally it , e2e. there task "test-all" runs tests. works correctly unless run e2e or test-all coverage plugin. i'm getting: java.lang.noclassdeffounderror: scoverage/invoker$

using show it:dependencyclasspath , show e2e:dependencyclasspath, can see e2e classpath missing scoverage plugin jars. idea what's wrong , how solve it?

build.sbt

import org.scalatra.sbt._ import sbt.keys._ import sbt._  object maappbuild extends build {   val organization = "com.my-org"   val name = "my app"   val version = "0.1.0-snapshot"   val scalaversion = "2.11.6"   val akkaversion = "2.3.4"    val scalatraversion = "2.3.0"   lazy val project = project(     "my-app",     file("."),     configurations = configurations.default ++ testing.configs,     settings = defaults.coredefaultsettings ++ scalatraplugin.scalatrasettings ++ testing.settings ++ seq(       organization := organization,       name := name,       version := version,       scalaversion := scalaversion,       resolvers += "sonatype oss snapshots" @ "http://oss.sonatype.org/content/repositories/snapshots/",       resolvers += "akka repo" @ "http://repo.akka.io/repository",       librarydependencies ++= seq(         "com.typesafe.akka" %% "akka-actor" % akkaversion,         "com.typesafe.akka" % "akka-testkit_2.11" % akkaversion % "test;it;e2e",         "net.databinder.dispatch" %% "dispatch-core" % "0.11.1",         "org.scalatra" %% "scalatra" % scalatraversion,         "com.typesafe.akka" %% "akka-testkit" % akkaversion % "test;it;e2e",         "org.scalatra" %% "scalatra-scalatest" % scalatraversion % "test;it;e2e",         "com.github.tomakehurst" % "wiremock" % "1.55" % "test;it;e2e",         "ch.qos.logback" % "logback-classic" % "1.0.6" % "runtime",         "org.scalatra" %% "scalatra-json" % "2.4.0.rc1",         "org.json4s" %% "json4s-jackson" % "3.2.11",         "com.typesafe" % "config" % "1.2.1",         "org.json4s" %% "json4s-native" % "3.2.11",         "org.eclipse.jetty" % "jetty-webapp" % "8.1.8.v20121106" % "container",         "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;provided;test" artifacts artifact("javax.servlet", "jar", "jar")       )     )   ) } 

integration , e2e tests configuration:

import sbt.keys._ import sbt._  object testing {   val integrationtest = config("it").extend(runtime)    val endtoendtest = config("e2e").extend(runtime)    val configs = seq(integrationtest, endtoendtest)    lazy val testall = taskkey[unit]("test-all")    private lazy val itsettings =     inconfig(integrationtest)(defaults.testsettings) ++       seq(         fork in integrationtest := false,         parallelexecution in integrationtest := false,         scalasource in integrationtest := basedirectory.value / "src/it/scala",         resourcedirectory in integrationtest := basedirectory.value / "src/test/resources")    private lazy val e2esettings =     inconfig(endtoendtest)(defaults.testsettings) ++       seq(         fork in endtoendtest := false,         parallelexecution in endtoendtest := false,         scalasource in endtoendtest := basedirectory.value / "src/e2e/scala",         resourcedirectory in endtoendtest := basedirectory.value / "src/test/resources")     lazy val settings = e2esettings ++ itsettings ++ seq(     testall <<= (test in endtoendtest) dependson (test in integrationtest) dependson(test in test)   ) } 

java.lang.noclassdeffounderror: scoverage/invoker$

addsbtplugin("com.mojolly.scalate" % "xsbt-scalate-generator" % "0.5.0")  addsbtplugin("org.scalatra.sbt" % "scalatra-sbt" % "0.3.5")  addsbtplugin("org.scoverage" % "sbt-scoverage" % "1.1.0") 

it seems need add setting sbt project:

works me, "org.scoverage" % "sbt-scoverage" % "1.5.0"

coverageenabled in test := true 

and have found version <1.4.0 there solution:

coverageenabled.in(thisbuild ,test, test) := true 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -