can`t import kamon-play-26 using SBT - scala

I updated my play to 2.6.0. I have a kamon dependency but sbt can't resolve this dependency.
Did anyone encounter this problem too?
Below is my libraryDependencies in the build.sbt:
libraryDependencies +=
Seq(
ws,
"com.google.inject" % "guice" % "3.0",
"com.typesafe.play" %% "play-json" % "2.6.0",
"io.kamon" %% "kamon-play-26" % "0.6.7"
)
But I get a below error as kamon-play-26 not found...

Kamon for Play 2.6 is available for Scala 2.11 and 2.12 with:
"io.kamon" %% "kamon-play-2.6" % "0.6.8"
Note the period in 2.6.

Searching through the kamon repositories in maven reveals that there is no kamon-play-26 package.
The github page https://github.com/kamon-io/kamon-play indicates that it does exist however. Perhaps its been pulled because the build is failing. Compile your own package from source, perhaps?

Related

How to define Scala API for Kafka Streams as dependency in build.sbt?

I am trying to start a new SBT Scala project and have the following in build.sbt file:
name := "ScalaKafkaStreamsDemo"
version := "1.0"
scalaVersion := "2.12.1"
libraryDependencies += "javax.ws.rs" % "javax.ws.rs-api" % "2.1" artifacts(Artifact("javax.ws.rs-api", "jar", "jar"))
libraryDependencies += "org.apache.kafka" %% "kafka" % "2.0.0"
libraryDependencies += "org.apache.kafka" % "kafka-streams" % "2.0.0"
So according to the GitHub repo, in 2.0.0 I should see the Scala classes/functions etc etc that I want to use, however they just don't seem to be available. Within IntelliJ I can open up the kafka-streams-2.0.0.jar, but I don't see any Scala classes.
Is there another JAR I need to include?
Just while we are on the subject of extra JARs, does anyone know what JAR I need to include to be able to use the EmbeddedKafkaCluster?
The artifact you need is kafka-streams-scala:
libraryDependencies += "org.apache.kafka" %% "kafka-streams-scala" % "2.0.1"
(please use 2.0.1, or even better 2.1.0, as 2.0.0 has some scala API bugs)
To answer your latter question, it's in the test-jar, which you can address using a classifier:
libraryDependencies += "org.apache.kafka" %% "kafka-streams" % "2.0.1" % "test" classifier "test"
But note that this is an internal class and subject to change (or removal) without notice. If at all possible, it's highly recommended that you use the TopologyTestDriver in the test-utils instead:
libraryDependencies += "org.apache.kafka" %% "kafka-streams-test-utils" % "2.0.1" % "test"
It looks like you face the issue of unresolved javax.ws.rs-api dependency that happens with some Java projects that are direct or transitive dependencies of Scala projects that use sbt. I've faced it with Scala projects that use Apache Spark and recently with Kafka Streams (with and without the Scala API).
A workaround that has worked fine for me is to simply exclude the dependency and define it again explicitly.
excludeDependencies += ExclusionRule("javax.ws.rs", "javax.ws.rs-api")
libraryDependencies += "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1"
Make sure that you use the latest and greatest of sbt (i.e. 1.2.7 as of the time of this writing).
With that said, the dependencies in build.sbt should be as follows:
scalaVersion := "2.12.8"
val kafkaVer = "2.1.0"
libraryDependencies += "org.apache.kafka" % "kafka-streams" % kafkaVer
libraryDependencies += "org.apache.kafka" %% "kafka-streams-scala" % kafkaVer
excludeDependencies += ExclusionRule("javax.ws.rs", "javax.ws.rs-api")
libraryDependencies += "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1"
Within IntelliJ I can open up the kafka-streams-2.0.0.jar, but I don't see any Scala classes. Is there another JAR I need to include?
The following dependency is all you need:
libraryDependencies += "org.apache.kafka" %% "kafka-streams-scala" % kafkaVer
You can also use following workaround, that works in my case - more details
here
import sbt._
object PackagingTypePlugin extends AutoPlugin {
override val buildSettings = {
sys.props += "packaging.type" -> "jar"
Nil
}
}

Unresolved dependency generating jar with SBT

I'm developing a Spark process in Scala (Eclipse IDE) and runs fine in my local cluster, but when I try to compiled it with SBT that I installed on my pc I got a error (see picture).
My first doubt is why SBT try to compile with scala 2.12 if I explicitly set scalaVersion to 2.11.11 in my build.sbt. I tried installing other SBT versions with the same results, also in other PCs but not works. I need help to fix it.
scala_version(Spark) :2.11.11
sbt_version : 1.0.2
spark: 2.2
build.sbt
name := "Comple"
version := "1.0"
organization := "com.antonio.spark"
scalaVersion := "2.11.11"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "2.2.0" % "provided",
"org.apache.spark" %% "spark-sql" % "2.2.0" % "provided"
)
assembly.sbt
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.0.2")
Error:
ResolveException: unresolved dependency: sbt_assembly;1.0.2: not found
Try changing your assembly.sbt file to:
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
as stated in the documentation here: https://github.com/sbt/sbt-assembly
I recently used that with spark-core_2.11 version 2.2.0 and it worked.

lift libs in Eclipse ScalaIDE is incompatible with all scala versions

Last day i start Scala with lift framework and Eclipse IDE. after checking this link:
http://scala-ide.org/docs/tutorials/lift24scalaide20/
I setup my project with eclipse. the first time the lift-basic runs as well as any project. but after trying to start a new project eclipse got 12 errors to me with content like this:
lift-actor_2.12-3.0.1.jar of lift_parsing_web build path is cross-compiled with an incompatible version of Scala (2.12.0). In case this report is mistaken, this check can be disabled in the compiler preference page.
hear is my build.sbt file:
name := "lift-parsing"
organization := "my.company"
version := "0.1-SNAPSHOT"
scalaVersion := "2.12.1"
libraryDependencies ++= {
val liftVersion = "3.0.1"
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile",
"org.mortbay.jetty" % "jetty" % "6.1.26" % "test",
"junit" % "junit" % "4.7" % "test",
"ch.qos.logback" % "logback-classic" % "0.9.26",
"org.scala-tools.testing" % "specs_2.9.1" % "1.6.9",
"com.h2database" % "h2" % "1.2.147"
)
}
in this file i test lift 3.0.1 with scala 2.12.1 as this two version are installed.
but before this test I used the default 2.9.1 scala version and 2.4 lift version and also same problems. in some solutions i change the compiler setting and ignore this error but after that eclipse can't biuld the project and make .class file.
scala: 2.12.1
sbt: 0.13
lift: 3.0.1
finally this is my screen error. thanks for help
errors screenshot
I would check to see if Eclipse has a separate Scala version configuration beyond the one that you define in your sbt file. 2.12.0 and 2.12.1 should be binary compatible, so this shouldn't be a problem if you're using 2.12.1. Also try to build this directly using sbt and see if it registers a problem---if not, that implies it's probably an Eclipse configuration issue.

Play project compiles successfully but IDEA cannot resolve symbols while importing dependencies

Piece of build.sbt related to Play! application project.
resolvers += Resolver.jcenterRepo,
resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
libraryDependencies ++= Seq(
"com.kyleu" %% "jdub-async" % "1.0",
"com.vmunier" %% "play-scalajs-scripts" % "0.3.0",
"org.webjars" % "jquery" % "1.11.1",
"org.json4s" %% "json4s-jackson" % "3.2.11",
evolutions,
"com.github.benhutchison" %% "prickle" % "1.1.7",
specs2 % Test
)
IDEA said to me that it cannot resolve symbol jdub when I import jdub-async library. Meanwhile project is compiling successfully.
How is it possible to fix this bug?
This is just an issue with IntelliJ IDEA's own Scala compiler. It chokes on many things. If it compiles fine with SBT itself, you don't have any bug to resolve (unless you want to report it to IntelliJ).

Scala parsing package isn't recognized

I try to import the scala.util.parsing library and the Eclipse compiler doesn't recognize it.
How can I fix it?
scala.util.parsing was removed from the standard library in Scala 2.11. Add this to your dependencies:
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.2"
Use this version if you're using Scala 2.13:
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
The imports are the same, so you can use import scala.util.parsing.json._ for example.
See here for all the published versions of this lib.