Can not resolve symbol Arbitrary - scala

I am trying to implement Arbitrary for my type as follow:
import cats._
import org.scalacheck.{Arbitrary, Gen}
object Server {
sealed trait ServerHealth
case object ServerOnline extends ServerHealth
case object ServerOffline extends ServerHealth
implicit val healthSemigroup: Semigroup[ServerHealth] = (x: ServerHealth, y: ServerHealth) => x match {
case ServerOnline if y == ServerOnline => ServerOnline
case ServerOffline => ServerOffline
}
implicit val healthEq: Eq[ServerHealth] = (x: ServerHealth, y: ServerHealth) => x match {
case ServerOnline if y == ServerOnline => true
case ServerOffline => false
}
implicit def healthArbitrary[A: Arbitrary]: Arbitrary[ServerHealth] =
Arbitrary(Gen.oneOf(Gen.const(ServerOffline), for {
e <- Arbitrary.arbitrary[A]
} yield (ServerOffline, ServerOnline)))
}
and the compiler complains:
object scalacheck is not a member of package org
[error] import org.scalacheck.{Arbitrary, Gen}
I using intellj and the import is marked as red:
I also checked the build.sbt file:
val Http4sVersion = "0.21.0-M4"
val CirceVersion = "0.12.1"
val Specs2Version = "4.7.0"
val LogbackVersion = "1.2.3"
val ScalaTestVersion = "3.0.8"
val TestContainerVersion = "1.11.3"
val KafkaTestContainerVersion = "1.11.3"
val ConfigVersion = "1.3.4"
val SpringVersion = "5.1.8.RELEASE"
val catsVersion = "2.0.0"
lazy val settings = Seq(
organization := "com.sweetsoft",
name := "connector",
scalaVersion := "2.13.0",
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.10.3"),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.0"),
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-language:higherKinds",
"-language:postfixOps",
"-feature",
"-Xfatal-warnings",
),
scalacOptions in(Compile, console) ~= {
_.filterNot(Set("-Xlint"))
}
)
lazy val dependencies = Seq(
"org.http4s" %% "http4s-blaze-server" % Http4sVersion,
"org.http4s" %% "http4s-blaze-client" % Http4sVersion,
"org.http4s" %% "http4s-circe" % Http4sVersion,
"org.http4s" %% "http4s-dsl" % Http4sVersion,
"io.circe" %% "circe-generic" % CirceVersion,
"ch.qos.logback" % "logback-classic" % LogbackVersion,
"org.typelevel" %% "cats-core" % catsVersion,
"com.typesafe" % "config" % ConfigVersion % "test",
"org.scalactic" %% "scalactic" % ScalaTestVersion % "test",
"org.scalatest" %% "scalatest" % ScalaTestVersion % "test",
"org.testcontainers" % "testcontainers" % TestContainerVersion % "test",
"org.testcontainers" % "kafka" % KafkaTestContainerVersion % "test",
"org.springframework" % "spring-core" % SpringVersion % "test",
"org.typelevel" %% "cats-laws" % catsVersion % "test",
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % "1.2.3" % "test",
"org.scalacheck" %% "scalacheck" % "1.14.0" % "test"
)
lazy val global = project
.in(file("."))
.settings(settings)
.aggregate(core, serversupervisor)
lazy val core = (project in file("core"))
.settings(
settings,
libraryDependencies ++= dependencies
)
lazy val serversupervisor = (project in file("serversupervisor"))
.settings(
settings,
libraryDependencies ++= dependencies
)
.dependsOn(core)
and I should be correct. What is missing?
Update
The implementation is in Server.scala marked on the image:
the serversupervisor project it depends on the core project, because there are some common libs.

You use this in the Compile scope (i.e. sources in src/main), so you need to remove % "test" from the ScalaCheck dependency. Or move that source to the Test scope (i.e. in src/test)

Related

Problems in compile scala project using SBT

I am trying to run a Scala project using SBT.
On compiling the project I am getting the below error -
play.sbt.PlayExceptions$CompilationException: Compilation error[Symbol 'type scalaxb.XMLStandardTypes' is missing from the classpath.
This symbol is required by 'trait connectors.concept.XMLProtocol'.
Make sure that type XMLStandardTypes is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'XMLProtocol.class' was compiled against an incompatible version of scalaxb.]
at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:34)
at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:34)
at scala.Option.map(Option.scala:230)
at play.sbt.run.PlayReload$.$anonfun$taskFailureHandler$1(PlayReload.scala:40)
at scala.Option.map(Option.scala:230)
at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:35)
at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:28)
at play.sbt.run.PlayReload$.$anonfun$compile$3(PlayReload.scala:63)
at scala.util.Either$LeftProjection.map(Either.scala:573)
at play.sbt.run.PlayReload$.compile(PlayReload.scala:63)
my project is using scalaVersion = "2.13.3" and SBT version is = "1.3.13".
Any pointers on how to compile this.
Below are my build.sbt and plugins.sbt files -
build.sbt file -
name := "test-manager"
organization := "zest"
resolvers in ThisBuild ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots"),
"Zest releases" at "https://test/test-releases",
"Zest snapshots" at "https://test/test-snapshots"
)
scalaVersion := "2.13.3"
scalacOptions += "-Ylog-classpath"
lazy val compactEvolutions = TaskKey[Unit]("compactEvolutions")
lazy val yarnBuild = taskKey[Unit]("Build frontend dependencies using yarn")
lazy val yarnWatch = taskKey[Unit]("Watch frontend dependencies using yarn")
lazy val supportedLanguages = Seq("en")
DefaultOptions.addCredentials
lazy val packageSettings = Seq(
maintainer in Linux := "test#test",
packageSummary in Linux := "Custom startscript parameters",
packageName in Linux := name.value,
packageDescription := "Custom startscript parameters",
daemonUser in Linux := "test_api",
daemonGroup in Linux := "test_api",
// rpm specific
rpmRelease := "1",
rpmVendor := "test",
rpmUrl := Some("http://test"),
rpmLicense := Some("Private"),
rpmGroup := Some("permission"),
//File mappings setting. Exclude all resource files
mappings in (Compile, packageBin) := {
val resourceFilenames = (resources in Compile).value.map(_.getName)
(mappings in (Compile, packageBin)).value.filterNot {
case (_, name) =>
resourceFilenames.contains(name)
}
},
scriptClasspath := "/test/conf" +: scriptClasspath.value
)
lazy val root = (project in file("."))
.enablePlugins(PlayScala, JavaAppPackaging, SystemdPlugin, RpmDeployPlugin)
.settings(packageSettings: _*)
.settings(
libraryDependencies ++= Seq(
guice,
ws,
filters,
"com.typesafe.play" %% "play-json" % "2.8.1",
"org.mockito" % "mockito-all" % "1.10.19" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test,
"com.norbitltd" %% "spoiwo" % "1.8.0",
"com.univocity" % "univocity-parsers" % "2.9.0",
"org.tpolecat" %% "doobie-core" % "0.9.0",
"org.tpolecat" %% "doobie-hikari" % "0.9.0",
"org.tpolecat" %% "doobie-postgres" % "0.9.0",
"org.tpolecat" %% "doobie-scalatest" % "0.9.0" % Test,
"com.github.tomakehurst" % "wiremock-standalone" % "2.27.1" % Test,
"org.flywaydb" % "flyway-core" % "6.5.5",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"org.dispatchhttp" %% "dispatch-core" % "1.1.3",
"org.scala-lang.modules" %% "scala-xml" % "1.3.0",
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
"commons-io" % "commons-io" % "2.7",
"org.typelevel" %% "cats-laws" % "2.1.1",
"de.svenkubiak" % "jBCrypt" % "0.4.1",
"io.github.jyllands-posten" %% "play-prometheus-filters" % "0.6.0"
),
javaOptions in Test += "-Dconfig.resource=application.test.conf",
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
scalacOptions += "-target:jvm-1.8",
maxErrors := 50,
routesImport += "common.Bindables._",
compactEvolutions := {
DbCompactor.compactEvolutions()
},
yarnBuild := {
scala.sys.process.Process("yarn" :: "build" :: Nil) ! new process.ProcessLogger {
override def out(s: => String): Unit =
println(s)
override def err(s: => String): Unit =
println(s)
override def buffer[T] (f: => T): T = f
}
},
yarnWatch := {
scala.sys.process.Process("yarn" :: "watch" :: Nil) run new process.ProcessLogger {
override def out(s: => String): Unit =
println(s)
override def err(s: => String): Unit =
println(s)
override def buffer[T] (f: => T): T = f
}
}
)
addCommandAlias("generate-bundles", "test:runMain common.sheets.BundleGenerator")
addCommandAlias("run-local", "run -Dconfig.resource=local.conf")
addCommandAlias("run-dev", "; yarnWatch; run-local")
and plugins.sbt file -
libraryDependencies += "commons-io" % "commons-io" % "2.7"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.4")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.8.0")
addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
resolvers += Resolver.sonatypeRepo("public")
I have tried to add scalaxb dependency in both the build.sbt and plugins.sbt file.
But still getting the same error.
Also I have compiled the project with scalacOptions += "-Ylog-classpath"
and there is only one scalaxb jar is bieng used.

Why subprojects does not recognize dependencies?

I've defined two sub projects that looks as follow:
val Http4sVersion = "0.21.0-M4"
val CirceVersion = "0.12.1"
val Specs2Version = "4.7.0"
val LogbackVersion = "1.2.3"
val ScalaTestVersion = "3.0.8"
val TestContainerVersion = "1.11.3"
val KafkaTestContainerVersion = "1.11.3"
val ConfigVersion = "1.3.4"
val SpringVersion = "5.1.8.RELEASE"
val CatsVersion = "2.0.0"
lazy val settings = Seq(
organization := "com.sweetsoft",
name := "connector",
scalaVersion := "2.13.0",
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.10.3"),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.0"),
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-language:higherKinds",
"-language:postfixOps",
"-feature",
"-Xfatal-warnings",
),
scalacOptions in(Compile, console) ~= {
_.filterNot(Set("-Xlint"))
}
)
lazy val dependencies = Seq(
"org.http4s" %% "http4s-blaze-server" % Http4sVersion,
"org.http4s" %% "http4s-blaze-client" % Http4sVersion,
"org.http4s" %% "http4s-circe" % Http4sVersion,
"org.http4s" %% "http4s-dsl" % Http4sVersion,
"io.circe" %% "circe-generic" % CirceVersion,
"ch.qos.logback" % "logback-classic" % LogbackVersion,
"org.typelevel" %% "cats-core" % CatsVersion,
"com.typesafe" % "config" % ConfigVersion % "test",
"org.scalactic" %% "scalactic" % ScalaTestVersion % "test",
"org.scalatest" %% "scalatest" % ScalaTestVersion % "test",
"org.testcontainers" % "testcontainers" % TestContainerVersion % "test",
"org.testcontainers" % "kafka" % KafkaTestContainerVersion % "test",
"org.springframework" % "spring-core" % SpringVersion % "test",
"org.typelevel" %% "cats-laws" % CatsVersion % "test",
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % "1.2.3" % "test",
"org.scalacheck" %% "scalacheck" % "1.14.0" % "test"
)
lazy val global = project
.in(file("."))
.settings(
settings,
libraryDependencies ++= dependencies
)
.aggregate(core, serversupervisor)
lazy val core = (project in file("core"))
.settings(settings)
lazy val serversupervisor = (project in file("serversupervisor"))
.settings(settings)
.dependsOn(core)
As you can see, the two subprojects are core and serversupervisor.
The problem is, that those two subprojects does not recognize dependencies:
I am using Intellj and as you can see, it does not recognize the dependencies.
What am I doing wrong?
Put libraryDependencies ++= dependencies into settings.
global, core and serversupervisor are three different subprojects. They can have different library dependencies. Currently you add them to global but not to core and serversupervisor.
Alternatively you can move libraryDependencies ++= dependencies to Global or
ThisBuild scope rather than specific subproject scope. You can add at top
ThisBuild / libraryDependencies ++= dependencies
or even
Global / libraryDependencies ++= dependencies
https://www.scala-sbt.org/1.x/docs/Multi-Project.html
https://www.scala-sbt.org/1.x/docs/Scopes.html

`java.lang.NoSuchMethodError: cats.FlatMap.map2` in runtime when using `.sequence`

I'm getting the following runtime error after migrating from cats v1.1.0 to v1.4.0 (An error arises from places where .sequence (cats.Traverse) is used).
The code looks like:
import cats.implicits._
import cats.effect.IO
List(1, 2, 3).map(x => IO(...)).sequence
java.lang.NoSuchMethodError: cats.FlatMap.map2$(Lcats/FlatMap;Ljava/lang/Object;Ljava/lang/Object;Lscala/Function2;)Ljava/lang/Object;
at cats.effect.IOLowPriorityInstances$IOEffect.map2(IO.scala:765)
...
Here is my build.sbt:
organization := "org.xxx"
name := "yyy"
version := "0.0.1"
scalaVersion := "2.12.9"
resolvers += Resolver.bintrayRepo("hseeberger", "maven")
resolvers ++= Seq("Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/")
lazy val doobieVersion = "0.5.3"
lazy val akkaHttpVersion = "10.1.1"
lazy val akkaVersion = "2.5.12"
lazy val catsVersion = "1.4.0"
lazy val circeVersion = "0.9.3"
lazy val doobieDeps = Seq(
"org.tpolecat" %% "doobie-core" % doobieVersion,
"org.tpolecat" %% "doobie-postgres" % doobieVersion,
"org.tpolecat" %% "doobie-scalatest" % doobieVersion,
"org.tpolecat" %% "doobie-hikari" % doobieVersion
)
lazy val catsDeps = Seq(
"org.typelevel" %% "cats-effect" % catsVersion,
"org.typelevel" %% "cats-core" % catsVersion
)
lazy val otherDeps = Seq(
"com.github.pureconfig" %% "pureconfig" % "0.9.1",
"org.scorexfoundation" %% "scrypto" % "2.1.1",
"de.heikoseeberger" %% "akka-http-circe" % "1.20.1",
"org.scalaj" %% "scalaj-http" % "2.4.0",
"org.flywaydb" % "flyway-core" % "5.1.1",
"com.github.blemale" %% "scaffeine" % "2.5.0",
("org.scorexfoundation" %% "sigma-state" % "master-2b4b07a1-SNAPSHOT")
.exclude("ch.qos.logback", "logback-classic")
.exclude("org.scorexfoundation", "scrypto"),
)
lazy val circeDeps = Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion
)
libraryDependencies ++= (otherDeps ++ doobieDeps ++ catsDeps ++ loggingDeps ++ akkaDeps ++ circeDeps ++ testDeps)
I've tried to run it different ways (idea, set run) and on different platforms - the result is always the same.
What could it be caused by?
Try to change versions to
"org.typelevel" %% "cats-effect" % "1.4.0",
"org.typelevel" %% "cats-core" % "1.6.1"
Your project seems to work with them.

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Incompatible Jackson version: 2.8.9

When I do df.show() to print the content of DataFrame rows, I get this error:
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Incompatible Jackson version: 2.8.9
at com.fasterxml.jackson.module.scala.JacksonModule$class.setupModule(JacksonModule.scala:64)
at com.fasterxml.jackson.module.scala.DefaultScalaModule.setupModule(DefaultScalaModule.scala:19)
at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:747)
at org.apache.spark.rdd.RDDOperationScope$.<init>(RDDOperationScope.scala:82)
at org.apache.spark.rdd.RDDOperationScope$.<clinit>(RDDOperationScope.scala)
This is how I create df:
object Test extends App {
val spark = SparkSession.builder()
.config("es.nodes", "XXX.XX.XX.XX")
.config("es.port", "9200")
.config("es.nodes.wan.only", "false")
.config("es.resource","myIndex")
.appName("Test")
.master("local[*]")
.getOrCreate()
val df_source = spark
.read.format("org.elasticsearch.spark.sql")
.option("pushdown", "true")
.load("myIndex")
df_source.show(5)
}
I do not use Jackson library in my build.sbt.
UPDATE:
import sbtassembly.AssemblyPlugin.autoImport.assemblyOption
name := "test"
lazy val spark = "org.apache.spark"
lazy val typesafe = "com.typesafe.akka"
val sparkVersion = "2.2.0"
val elasticSparkVersion = "6.2.4"
val scalaLoggingVersion = "3.7.2"
val slf4jVersion = "1.7.5"
val kafkaVersion = "0.8.0.0"
val akkaVersion = "2.5.9"
val playVersion = "2.6.8"
val sprayVersion = "1.3.2"
val opRabbitVersion = "2.1.0"
val orientdbVersion = "2.2.34"
val livyVersion = "0.5.0-incubating"
val scalaHttpVersion = "2.3.0"
val scoptVersion = "3.3.0"
resolvers ++= Seq(
// repo for op-rabbit client
"SpinGo OSS" at "http://spingo-oss.s3.amazonaws.com/repositories/releases",
"SparkPackagesRepo" at "http://dl.bintray.com/spark-packages/maven",
"cloudera.repo" at "https://repository.cloudera.com/artifactory/cloudera-repos"
)
lazy val commonSettings = Seq(
organization := "org.test",
version := "0.1",
scalaVersion := "2.11.8",
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = true),
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs # _*) => MergeStrategy.discard
case PathList("reference.conf") => MergeStrategy.concat
case x => MergeStrategy.first
}
)
val sparkSQL = spark %% "spark-sql" % sparkVersion
val sparkGraphx = spark %% "spark-graphx" % sparkVersion
val sparkMLLib = spark %% "spark-mllib" % sparkVersion
val elasticSpark = "org.elasticsearch" % "elasticsearch-hadoop" % elasticSparkVersion
val livyAPI = "org.apache.livy" % "livy-api" % livyVersion
val livyScalaAPI = "org.apache.livy" %% "livy-scala-api" % livyVersion
val livyClientHttp = "org.apache.livy" % "livy-client-http" % livyVersion
val spingoCore = "com.spingo" %% "op-rabbit-core" % opRabbitVersion
val spingoPlayJson = "com.spingo" %% "op-rabbit-play-json" % opRabbitVersion
val spingoJson4s = "com.spingo" %% "op-rabbit-json4s" % opRabbitVersion
val spingoAirbrake = "com.spingo" %% "op-rabbit-airbrake" % opRabbitVersion
val spingoAkkaStream = "com.spingo" %% "op-rabbit-akka-stream" % opRabbitVersion
val orientDB = "com.orientechnologies" % "orientdb-graphdb" % orientdbVersion excludeAll(
ExclusionRule("commons-beanutils", "commons-beanutils-core"),
ExclusionRule("commons-collections", "commons-collections"),
ExclusionRule("commons-logging", "commons-logging"),
ExclusionRule("stax", "stax-api")
)
val scopt = "com.github.scopt" %% "scopt" % scoptVersion
val spray = "io.spray" %% "spray-json" % sprayVersion
val scalaHttp = "org.scalaj" %% "scalaj-http" % scalaHttpVersion
lazy val graph = (project in file("./app"))
.settings(
commonSettings,
libraryDependencies ++= Seq(sparkSQL, sparkGraphx, sparkMLLib, orientDB,
livyAPI, livyScalaAPI, livyClientHttp, scopt,
spingoCore, scalaHttp,
spray, spingoCore, spingoPlayJson, spingoJson4s,
spingoAirbrake, spingoAkkaStream, elasticSpark)
)
dependencyOverrides += "com.typesafe.akka" %% "akka-stream" % akkaVersion
I tried to add Jackson libraries for Spark, but it didn't solve the problem:
val jacksonCore = "com.fasterxml.jackson.core" % "jackson-core" % "2.6.5"
val jacksonDatabind = "com.fasterxml.jackson.core" % "jackson-databind" % "2.6.5"
val jacksonAnnotations = "com.fasterxml.jackson.core" %% "jackson-annotations" % "2.6.5"
val jacksonScala = "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.6.5"
Finally, I did this (the last two dependencies cannot be resolved for some reason):
dependencyOverrides += "com.typesafe.akka" %% "akka-stream" % akkaVersion
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9"
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.9"
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.9"
dependencyOverrides += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.8.9"
dependencyOverrides += "com.fasterxml.jackson.module" % "jackson-module-paranamer" % "2.8.9"
But now I get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/module/scala/DefaultScalaModule$
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.module.scala.DefaultScalaModule$
jackson version for Spark 2.2.0 is 2.6.5, it looks like one of your other dependencies is using jackson 2.8.9, these two versions are not compatible so you need to align them to the same jackson version.
This build.sbt looks very problematic since you have mixed a lot of thing that probably don't align in jackson and with other dependencies.
For example op-rabbit-json4s is expecting jackson to be 3.5.3, on the other hand I think that orientdb-graphdb is expecting a third version of jackson (2.2.3)
In summary, you need to align as much as possible your dependencies to make sure there are no concflicts.
Here you can find a useful plugin to check dependencies https://github.com/jrudolph/sbt-dependency-graph

sbt assembly error deduplicate

Getting started with sbt.
I am getting this error during sbt assembly
deduplicate: different file contents found in the following:
../.ivy2/cache/org.scalatest/scalatest_2.11/bundles/scalatest_2.11-2.2.6.jar:org/scalactic/SeqEqualityConstraints$.class
../.ivy2/cache/org.scalactic/scalactic_2.11/bundles/scalactic_2.11-3.0.0.jar:org/scalactic/SeqEqualityConstraints$.class
this is my build sbt :
scalaVersion := "2.11.8"
scalacOptions := Seq("-unchecked", "-feature", "-deprecation", "-encoding", "utf8")
libraryDependencies ++= {
val phantomV = "1.29.5"
val scalaTestV = "2.2.6"
val scalaMockV = "3.4.2"
val elastic4sV = "2.4.0"
val akkaStreamVersion = "2.4.10"
val akkaVersion = "2.3.12"
Seq(
"com.websudos" %% "phantom-dsl" % phantomV,
"com.websudos" %% "phantom-reactivestreams" % phantomV,
"com.websudos" %% "util-testing" % "0.13.0" % "test, provided",
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-http-spray-json-experimental" % akkaStreamVersion,
"com.typesafe.akka" %% "akka-http-core" % akkaStreamVersion,
"com.typesafe.akka" %% "akka-http-experimental" % akkaStreamVersion,
"com.typesafe.akka" %% "akka-http-testkit" % akkaStreamVersion,
"com.typesafe.akka" %% "akka-stream" % akkaStreamVersion,
"com.typesafe.akka" %% "akka-stream-testkit" % akkaStreamVersion,
"org.scalatest" %% "scalatest" % scalaTestV % "test, provided",
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test, provided",
"com.typesafe.play" %% "play-streams-experimental" % "2.4.6" % "provided",
"com.sksamuel.elastic4s" %% "elastic4s-core" % elastic4sV,
"com.sksamuel.elastic4s" %% "elastic4s-streams" % elastic4sV,
"org.scalamock" %% "scalamock-scalatest-support" % scalaMockV % "test, provided",
"com.typesafe" % "config" % "1.3.1"
)
}
lazy val root = project.in(file("."))
.settings(mainClass in assembly := Some("com.ind.Main"))
initialCommands := """|import akka.actor._
|import akka.pattern._
|import akka.util._
|import scala.concurrent._
|import scala.concurrent.duration._""".stripMargin
fork in run := true
test in assembly := {}
any idea why am getting that and how can I solve it ?
===== UPDATE ====
I did managed to solve it by adding
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs # _*) => MergeStrategy.discard
case x => MergeStrategy.first
}
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs # _*) => MergeStrategy.discard
case x => MergeStrategy.first
}
The ScalaTest and Scalactic version numbers need to match. You have a ScalaTest 2.2.6 trying to use a Scalactic 3.0.0, so that's the problem. One of your dependencies is perhaps using Scalactic 3.0.0.