With sbt 0.13.8 and Scala 2.10.5, which dependencies are required in build.sbt and plugins.sbt to install Cucumber ?
SBT does not resolve info.cukes dependencies below.
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-library" % "2.10.5",
"junit" % "junit" % "4.11" % "test",
"org.scala-lang" % "scala-compiler" % "2.10.5",
"org.scala-lang" % "scala-reflect" % "2.10.5",
"info.cukes" % "cucumber-scala" % "1.1.6",
"info.cukes" % "cucumber-core" % "1.1.6"
)
There is a different build of cucumber-scala for each version of Scala. So, you have to mention the desired Scala version. You can provide it in the name of artifact, for example:
libraryDependencies += "info.cukes" % "cucumber-scala_2.12" % "1.2.4"
or you can use the SBT shortcut "%%" which will substitute the correct Scala version for you:
libraryDependencies += "info.cukes" %% "cucumber-scala" % "1.2.4"
Related
In a Scala 2.13.4/SBT 1.2.8 project, the class MyService.scala has this import:
import play.api.libs.concurrent.AkkaGuiceSupport
I think the library that contains this class, is added by sbt as a dependency of one of the libraries that I added as libraryDependencies in build.sbt.
However when I compile the project, I get:
$ sbt -java-home /usr/lib/jvm/java-8 -jvm-debug 9999 run
...
[info] Compiling 31 Scala sources and 1 Java source to /home/me/projects/my_project/target/scala-2.13/classes ...
[error] /home/me/projects/my_project/app/actors/MyService.scala:8:8: object AkkaGuiceSupport is not a member of package play.api.libs.concurrent
[error] import play.api.libs.concurrent.AkkaGuiceSupport
[error] ^
In IntelliJ, in the project's External Libraries, I can see:
What am I missing here?
What could be the reason for this compilation error?
........................................................
Update:
build.sbt
name := "CH07"
version := "1.0"
lazy val `ch07` = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.13.4"
resolvers += "Spy Repository" at "http://files.couchbase.com/maven2"
libraryDependencies ++= Seq(
jdbc,
cacheApi,
ws,
"com.github.mumoshu" %% "play2-memcached-play28" % "0.11.0",
"org.hsqldb" % "hsqldb" % "2.5.0",
"org.jooq" % "jooq" % "3.14.4",
"org.jooq" % "jooq-codegen-maven" % "3.14.4",
"org.jooq" % "jooq-meta" % "3.14.4",
"joda-time" % "joda-time" % "2.7",
"com.ning" % "async-http-client" % "1.9.29",
"com.github.scullxbones" %% "akka-persistence-mongo-common" % "3.0.5",
"com.typesafe.akka" %% "akka-persistence" % "2.6.10",
"com.typesafe.akka" %% "akka-persistence-query" % "2.6.10",
"com.typesafe.akka" %% "akka-persistence-typed" % "2.6.10"
)
routesGenerator := InjectedRoutesGenerator
project/plugins.sbt
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.7")
project/build.properties
sbt.version=1.3.10
First, you can see it because it is part of the play framework. You can see in PlayImport more packages that you did not import but they are there because of play. For example, if you remove jdbc from libraryDependencies, you will probably see more such errors (just with a different package name, and only in case you are actually using it). Note that you will be able to find the missing classes in the IntelliJ tree, while the compiler won't.
The missing import in your case is guice. AkkaGuiceSupport is part of guice. Try to add it into your library dependencies:
libraryDependencies ++= Seq(
guice, // This is the missing part
jdbc,
cacheApi,
ws,
"com.github.mumoshu" %% "play2-memcached-play28" % "0.11.0",
"org.hsqldb" % "hsqldb" % "2.5.0",
"org.jooq" % "jooq" % "3.14.4",
"org.jooq" % "jooq-codegen-maven" % "3.14.4",
"org.jooq" % "jooq-meta" % "3.14.4",
"joda-time" % "joda-time" % "2.7",
"com.ning" % "async-http-client" % "1.9.29",
"com.github.scullxbones" %% "akka-persistence-mongo-common" % "3.0.5",
"com.typesafe.akka" %% "akka-persistence" % "2.6.10",
"com.typesafe.akka" %% "akka-persistence-query" % "2.6.10",
"com.typesafe.akka" %% "akka-persistence-typed" % "2.6.10"
)
:)
I'm getting an error that I have no idea how to fix.. I could not really find outstanding documentation for this SchemaRDD type, and how to use it.
build.sbt contains:
scalaVersion := "2.11.12"
libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.0"
libraryDependencies += "org.scalaj" %% "scalaj-http" % "2.4.1"
libraryDependencies += "io.spray" %% "spray-json" % "1.3.5"
libraryDependencies += "com.amazonaws" % "aws-java-sdk-core" % "1.11.534"
libraryDependencies += "com.amazonaws" % "aws-encryption-sdk-java" % "1.3.6"
libraryDependencies += "com.amazonaws" % "aws-java-sdk" % "1.11.550"
libraryDependencies += "com.typesafe" % "config" % "1.3.4"
libraryDependencies += "org.elasticsearch" %% "elasticsearch-spark-1.2" % "2.4.4"
Error:
Symbol 'type org.apache.spark.sql.SchemaRDD' is missing from the classpath.
[error] This symbol is required by 'value org.elasticsearch.spark.sql.package.rdd'.
[error] Make sure that type SchemaRDD is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'package.class' was compiled against an incompatible version of org.apache.spark.sql.
Thank you a lot for all kind of support! :)
Dependency elasticsearch-spark-1.2 is for Spark 1.x, need to use elasticsearch-spark-20 instead. The latest version is built for Spark 2.3
libraryDependencies += "org.elasticsearch" %% "elasticsearch-spark-20" % "7.1.1"
I have a project/Generate.scala that generates some Scala code destined for sourceManaged. Generate.scala has its own dependencies. From the sbt documentation, it seems that those dependencies should go into project/build.sbt. When I tried that, sbt stops resolving my plugins declared in project/plugins.sbt.
What's the right way to declare these dependencies? And how should I think about the meta-build conceptually? It looks like I misunderstand "sbt is recursive."
project/build.sbt:
scalaVersion in ThisBuild:= "2.12.2"
resolvers += Resolver.sonatypeRepo("releases")
resolvers += Resolver.bintrayRepo("scalameta", "maven")
libraryDependencies += "org.scalameta" %% "scalameta" % "1.7.0"
project/plugins.sbt:
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "3.0.1")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M15")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.16")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.6" exclude ("com.trueaccord.scalapb", "protoc-bridge_2.10"))
libraryDependencies += "com.trueaccord.scalapb" %% "compilerplugin-shaded" % "0.6.0-pre3"
I have imported several of the sdk components to my sbt file. In intelliJ all compiles fine, and when I try to compile in sbt I get an error of
object microsoft is not a member of package com`
libraryDependencies ++= Seq(
"com.microsoft.azure" % "azure-mgmt-resources" % "0.8.3",
"com.microsoft.azure" % "azure-management" % "0.8.0",
"com.microsoft.azure" % "azure-storage" % "4.0.0",
"com.microsoft.azure" % "azure-mgmt-utility" % "0.8.3" exclude ("commons-codec", "commons-codec"),
"com.sun.jersey" % "jersey-core" % "1.19"
)
I Had to do sbt reload in order to refresh the dependencies
I am using IntelliJ IDEA 13.1.2 with the Scala plugin version 0.36.431 on Windows 7 with sbt 0.13.1.
The following project definition build.sbt has no references to any Scala version other than 2.9.3.
import sbt._
import Keys._
import AssemblyKeys._
import NativePackagerKeys._
name := "simplews"
version := "0.1.0-SNAPSHOT"
val sparkVersion = "0.8.1-incubating"
scalaVersion := "2.9.3"
val akkaVersion = "2.0.5"
libraryDependencies ++= Seq(
"org.apache.spark" % "spark-core_2.9.3" % sparkVersion % "compile->default" withSources(),
"org.apache.spark" % "spark-examples_2.9.3" % sparkVersion % "compile->default" withSources(),
"org.apache.spark" % "spark-tools_2.9.3" % sparkVersion % "compile->default" withSources(),
"org.scalatest" % "scalatest_2.9.3" % "1.9.2" % "test" withSources(),
"org.apache.spark" % "spark-repl_2.9.3" % sparkVersion % "compile->default" withSources(),
"org.apache.kafka" % "kafka" % "0.7.2-spark",
"com.thenewmotion.akka" % "akka-rabbitmq_2.9.2" % "0.0.2" % "compile->default" withSources(),
"com.typesafe.akka" % "akka-actor" % akkaVersion % "compile->default" withSources(),
"com.typesafe.akka" % "akka-testkit" % akkaVersion % "compile->default" withSources(),
"com.rabbitmq" % "amqp-client" % "3.0.1" % "compile->default" withSources(),
"org.specs2" % "specs2_2.9.3" % "1.12.4.1" % "compile->default" withSources(),
"com.nebhale.jsonpath" % "jsonpath" % "1.2" % "compile->default" withSources(),
"org.mockito" % "mockito-all" % "1.8.5",
"junit" % "junit" % "4.11"
)
packagerSettings
packageArchetype.java_application
resolvers ++= Seq(
"Apache repo" at "https://repository.apache.org/content/repositories/releases",
"Cloudera repo" at "https://repository.cloudera.com/artifactory/repo/org/apache/kafka/kafka/0.7.2-spark/",
"akka rabbitmq" at "http://nexus.thenewmotion.com/content/repositories/releases-public",
"Local Repo" at Path.userHome.asFile.toURI.toURL + "/.m2/repository",
Resolver.mavenLocal
)
However as seen in the screenshot the debugger has jumped to scala 2.10.2. Note: the debugger is correctly going to 2.9.3 for some other debugging.
Here is project/plugins.sbt:
resolvers += "sbt-plugins" at "http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.0-RC2")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")
EDIT In order to reproduce it is necessary to do a mvn local install on one or two libraries that are not available in any public repo.
mvn org.apache.maven.plugins:maven-install-plugin:2.5.1:install-file -Dfile=c:\shared\kafka-0.7.2-spark.jar -DgroupId=org.apache.kafka -DartifactId=kafka -Dversion=0.7.2-spark -Dpackaging=jar
I had in any case not considered someone (om-nom-nom !) would attempt an exact reproduction - so had also omitted otherwise extraneous items like mergeStrategy and assemblyKeys.
A fully independent reproducible setup may be a bit in coming - I have been under rather quite heavy demands here.