I have a scalatra project built the standard way using giter8.
I am uncertain why container:start no longer functions in my scalatra project: no change was made to build.sbt. here is the error:
Using /home/stephen/.sbt/0.12.0 as sbt dir, -sbt-dir to override.
[info] Set current project to wfdemo (in build file:/home/stephen/wfdemo/)
> container:start
[error] Not a valid key: start (similar: state, startYear, target)
[error] container:start
[error]
Here is the sbt:
object KeywordsservletBuild extends Build {
val Organization = "com.astralync"
val Name = "KeywordsServlet"
val Version = "0.1.0-SNAPSHOT"
val ScalaVersion = "2.11.7"
val ScalatraVersion = "2.4.0-RC2-2"
lazy val project = Project (
"keywordsservlet",
file("."),
settings = ScalatraPlugin.scalatraSettings ++ scalateSettings ++ Seq(
organization := Organization,
name := Name,
version := Version,
scalaVersion := ScalaVersion,
resolvers += Classpaths.typesafeReleases,
resolvers += "Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases",
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "1.3.1",
"org.scalatra" %% "scalatra" % ScalatraVersion,
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
"ch.qos.logback" % "logback-classic" % "1.1.2" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "9.2.13.v20150730" % "container",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
"net.databinder" % "unfiltered-netty_2.11" % "0.8.4"
),
scalateTemplateConfig in Compile <<= (sourceDirectory in Compile){ base =>
Seq(
TemplateConfig(
base / "webapp" / "WEB-INF" / "templates",
Seq.empty, /* default imports should be added here */
Seq(
Binding("context", "_root_.org.scalatra.scalate.ScalatraRenderContext", importMembers = true, isImplicit = true)
), /* add extra bindings here */
Some("templates")
)
)
}
)
)
}
Suggestions appreciated.
Small but not necessarily obvious fix for this:
; container:start ; shell
The leading semicolon is required.
Related
I am trying to upgrade mumoshu's Memcached Plugin for Play framework, to Play 2.8.6, in build.sbt.
The upgrade instructions are:
For Play 2.6.x and newer: !!! Changed play.modules.cache.* config keys to play.cache.* !!!
val appDependencies = Seq(
play.PlayImport.cacheApi,
"com.github.mumoshu" %% "play2-memcached-play26" % "0.9.2"
)
val main = Project(appName).enablePlugins(play.PlayScala).settings(
version := appVersion,
libraryDependencies ++= appDependencies,
resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
)
Before the upgrade, I had:
libraryDependencies ++= Seq(
jdbc,
cache,
ws,
"com.github.mumoshu" %% "play2-memcached-play24" % "0.7.0",
//...
}
After the (unsuccessful) upgrade:
the cache dependency is not resolved, so I removed it.
The updated build.sbt now looks like this:
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"
val appDependencies = Seq(
play.sbt.PlayImport.cache,
"com.github.mumoshu" %% "play2-memcached-play28" % "0.11.0"
//"com.github.mumoshu" %% "play2-memcached-play26" % "0.9.2"
)
val main = (project in file(".")).enablePlugins(play.sbt.PlayScala).settings(
version := version.value,
libraryDependencies ++= appDependencies,
resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
)
libraryDependencies ++= Seq(
jdbc,
//cache,
ws,
"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.github.ironfish" %% "akka-persistence-mongo-casbah" % "0.7.6",
"com.ning" % "async-http-client" % "1.9.29"
)
routesGenerator := InjectedRoutesGenerator
Errors I am getting:
* build.sbt:
error: value cache is not a member of object play.sbt.PlayImport
* build.sbt:
"com.github.mumoshu" %% "play2-memcached-play28" % "0.11.0"
Intellij says: unresolved artifact. Not resolved or indexed.
* in project/plugins.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.6")
Intellij says: unresolved artifact. Not resolved or indexed.
Can you see any errors I made in the build.sbt?
In other words, I am looking for a working build.sbt (and the other required definitions) example for a project that uses Play 2.8.6 and the Memcached Plugin for Play framework 0.9.2. (or highest possible version of the latter).
UPDATE:
This is my current configuration which does compile:
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",
"com.typesafe.play" %% "play-guice" % "2.8.7"
)
routesGenerator := InjectedRoutesGenerator
project/build.properties
sbt.version=1.3.10
project/plugins.sbt
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.7")
How about this?
name := """pla-memcache-example"""
organization := "com.example"
version := "1.0-SNAPSHOT"
scalaVersion := "2.13.3"
val appDependencies = Seq(
guice,
play.PlayImport.cacheApi,
"com.github.mumoshu" %% "play2-memcached-play28" % "0.11.0",
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test
)
lazy val root = (project in file(".")).enablePlugins(PlayScala).settings(
version := appVersion,
libraryDependencies ++= appDependencies,
resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
)
plugins.sbt
sbt.version=1.3.13
plugins.sbt
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.7")
In this case, first find the giter8 template and use the "sbt new" command.
Next, go to the official page of the plugin and check the name of the library, and then use Maven search to find the version you want to use.
It's a good idea to read the entire readme of the plugin without skipping it.
You can also try to run sbt with commands instead of using IntelliJ.
If that doesn't solve the problem, you can try clearing the cache in the .ivy2 directory.
Reference Links:
https://github.com/mumoshu/play2-memcached
https://github.com/playframework/play-scala-seed.g8
https://search.maven.org/artifact/com.github.mumoshu/play2-memcached-play28_2.13/0.11.0/jar
Your issue is when trying to import play.sbt.PlayImport.cache. According to Cache APIs Migration by play:
New packages
Now `cache` has been split into a `cacheApi` component with just the API, and `ehcache` that contains the Ehcache implementation. If you are using the default Ehcache implementation, simply change `cache` to `ehcache` in your `build.sbt`:
libraryDependencies ++= Seq(
ehcache
)
If you are defining a custom cache API, or are writing a cache implementation module, you can just depend on the API:
libraryDependencies ++= Seq(
cacheApi
)
Removed APIs
The deprecated Java class play.cache.Cache was removed and you now must inject an play.cache.SyncCacheApi or play.cache.AsyncCacheApi.
Therefore a complete build.sbt will be:
name := "CH07"
version := "1.0"
lazy val `ch07` = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.13.4"
resolvers += "Spy Repository" at "https://files.couchbase.com/maven2"
val appDependencies = Seq(
play.sbt.PlayImport.ehcache,
play.sbt.PlayImport.cacheApi,
"com.github.mumoshu" %% "play2-memcached-play28" % "0.11.0"
//"com.github.mumoshu" %% "play2-memcached-play26" % "0.9.2"
)
val main = (project in file(".")).enablePlugins(play.sbt.PlayScala).settings(
version := version.value,
libraryDependencies ++= appDependencies,
resolvers += "Spy Repository" at "https://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
)
libraryDependencies ++= Seq(
jdbc,
//cache,
ws,
"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.github.scullxbones" %% "akka-persistence-mongo-common" % "3.0.5",
"com.ning" % "async-http-client" % "1.9.29"
)
routesGenerator := InjectedRoutesGenerator
build.properties:
sbt.version=1.4.4
plugins.sbt:
logLevel := Level.Warn
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.7")
I created Scalatara application to build a web service. It uses Jetty server and it was included in the build.sbt file when I created the project itself.
But when I try to start the jetty server using the command - jetty:start, it shows me an error message "not a valid key: jetty". Then when I checked the build file, it shows a warning message as "unknown artifact in sbt" for the below dependency.
"org.eclipse.jetty" % "jetty-webapp" % "9.4.6.v20170531" % "container"
I used the latest dependency from the MVN Repository but still, it shows the same error. Is there anything else I have to do here?
How did you create the project? Is there a way you can tell me so I can reproduce it. Will be much easier to figure out. Anyways, you can try to add a resolver first to your build.sbt :
resolvers += "Jetty" at "https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-webapp"
Kindly compare the code of build.sbt file shown below and if anything missing you should update in you build.st file.
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import ScalateKeys._
val ScalatraVersion = "2.5.1"
ScalatraPlugin.scalatraSettings
scalateSettings
organization := "com.github.karthikeyana"
name := "My Scalatra Web App"
version := "0.1.0-SNAPSHOT"
scalaVersion := "2.12.3"
resolvers += Classpaths.typesafeReleases
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % ScalatraVersion,
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
"ch.qos.logback" % "logback-classic" % "1.1.5" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "9.2.15.v20160210" % "container",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
"org.mongodb" %% "casbah" % "3.1.1"
)
scalateTemplateConfig in Compile := {
val base = (sourceDirectory in Compile).value
Seq(
TemplateConfig(
base / "webapp" / "WEB-INF" / "templates",
Seq.empty, /* default imports should be added here */
Seq(
Binding("context", "_root_.org.scalatra.scalate.ScalatraRenderContext", importMembers = true, isImplicit = true)
), /* add extra bindings here */
Some("templates")
)
)
}
enablePlugins(JettyPlugin)
I use SBT to include dependencies in my project, but I couldn't find the reason why some dependencies are ignored randomly. Even if they exist in .ivy2/cache directory, I tried to delete the content of it and retry but I still have the same problem.
The version of my SBT is 0.13.15 here is an example:
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import ScalateKeys._
val ScalatraVersion = "2.4.1"
ScalatraPlugin.scalatraSettings
scalateSettings
organization := "com.*****"
name := "****"
version := "0.1.0-SNAPSHOT"
scalaVersion := "2.10.5"
val sparkVersion = "1.6.0"
resolvers += Classpaths.typesafeReleases
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra-json" % ScalatraVersion,
"org.json4s" %% "json4s-jackson" % "3.2.11",
"org.scalatra" %% "scalatra" % ScalatraVersion,
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
"ch.qos.logback" % "logback-classic" % "1.1.5" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "9.2.15.v20160210" % "container",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
)
libraryDependencies += "org.apache.spark" %% "spark-core" % sparkVersion
libraryDependencies += "org.apache.spark" %% "spark-sql" % sparkVersion
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.2.14"
scalateTemplateConfig in Compile := {
val base = (sourceDirectory in Compile).value
Seq(
TemplateConfig(
base / "webapp" / "WEB-INF" / "templates",
Seq.empty, /* default imports should be added here */
Seq(
Binding("context", "_root_.org.scalatra.scalate.ScalatraRenderContext", importMembers = true, isImplicit = true)
), /* add extra bindings here */
Some("templates")
)
)
}
enablePlugins(JettyPlugin)
In my example, sometimes the scalatra jsonis ignored and when I retried to create a new project the sparkdependencies was ignored
I finally found the solution of my issues, my project had to be converted to eclipse project through SBT with sbt eclipse command.
Initially the Scalatra project was created via SBT with this command:
sbt new scalatra/scalatra-sbt.g8
The trick is to eclipsify the project before beginning to import dependencies.
I have an SBT project with structure like here: https://orrsella.com/2014/09/24/integration-and-end-to-end-test-configurations-in-sbt-for-scala-java-projects/. It includes standard main and test directories and additionally it and e2e. There is also a task "test-all" which runs all tests. Everything works correctly unless I run e2e or test-all together with coverage plugin. I'm getting: java.lang.NoClassDefFoundError: scoverage/Invoker$
Using show it:dependencyClasspath and show e2e:dependencyClasspath, I can see that e2e classpath is missing scoverage plugin jars. Any idea what's wrong and how to 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" at "http://oss.sonatype.org/content/repositories/snapshots/",
resolvers += "Akka Repo" at "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 and 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 that you need to add a setting to your sbt project:
works for me, with "org.scoverage" % "sbt-scoverage" % "1.5.0"
coverageEnabled in Test := true
and I have found that for version <1.4.0 there was another solution:
coverageEnabled.in(ThisBuild ,Test, test) := true
So I have a Scalatra app (using Scalatra 2.2.1). I'm building views using Scalate; I've decided to go with the Jade/Markdown one-two. Only one problem: if I try to use markdown in a jade template (started with the :markdown tag), I get this:
scala.Predef$.any2ArrowAssoc(Ljava/lang/Object;)Lscala/Predef$ArrowAssoc;
java.lang.NoSuchMethodError: scala.Predef$.any2ArrowAssoc(Ljava/lang/Object;)Lscala/Predef$ArrowAssoc;
at org.fusesource.scalamd.Markdown$.<init>(md.scala:119)
at org.fusesource.scalamd.Markdown$.<clinit>(md.scala:-1)
at org.fusesource.scalate.filter.ScalaMarkdownFilter$.filter(ScalaMarkdownFilter.scala:32)
at org.fusesource.scalate.RenderContext$class.filter(RenderContext.scala:276)
at org.fusesource.scalate.DefaultRenderContext.filter(DefaultRenderContext.scala:30)
at org.fusesource.scalate.RenderContext$class.value(RenderContext.scala:235)
at org.fusesource.scalate.DefaultRenderContext.value(DefaultRenderContext.scala:30)
at templates.views.$_scalate_$about_jade$.$_scalate_$render(about_jade.scala:37)
at templates.views.$_scalate_$about_jade.render(about_jade.scala:48)
at org.fusesource.scalate.DefaultRenderContext.capture(DefaultRenderContext.scala:92)
at org.fusesource.scalate.layout.DefaultLayoutStrategy.layout(DefaultLayoutStrategy.scala:45)
at org.fusesource.scalate.TemplateEngine$$anonfun$layout$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(TemplateEngine.scala:559)
at org.fusesource.scalate.TemplateEngine$$anonfun$layout$1$$anonfun$apply$mcV$sp$1.apply(TemplateEngine.scala:559)
at org.fusesource.scalate.TemplateEngine$$anonfun$layout$1$$anonfun$apply$mcV$sp$1.apply(TemplateEngine.scala:559)
So that's pretty cool. The error vanishes as soon as I remove the :markdown flag, and beyond that everything compiles (beyond markdown not getting rendered correctly).
Things I know and have found so far:
There's some thought that this error is the biproduct of incompatible Scala versions somewhere in the build. My build.scala defines Scala version as 2.10.0, which Scalatra is explicitly compatible with.
...that said, I have no idea which version of Scalate Scalatra pulls in, and my attempts to override it have not worked so far. I know the current stable of Scalate (1.6.1) is only compatible up to Scala 2.10.0 -- but that's what I'm using.
I am, however, sure that my classpath is clean. I have no conflicting Scala versions. Everything is 2.10.0 in the dependencies.
Has anybody worked with this one before? Any ideas?
EDIT
Per request, here are my build definitions:
//build.sbt
libraryDependencies += "org.scalatest" %% "scalatest" % "2.0.M5b" % "test"
libraryDependencies += "org.twitter4j" % "twitter4j-core" % "3.0.3"
libraryDependencies += "org.fusesource.scalamd" % "scalamd" % "1.5"
//build.properties
sbt.version=0.12.3
//build.scala
import sbt._
import Keys._
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import com.mojolly.scalate.ScalatePlugin._
import ScalateKeys._
object TheRangeBuild extends Build {
val Organization = "com.gastove"
val Name = "The Range"
val Version = "0.1.0-SNAPSHOT"
val ScalaVersion = "2.10.0"
val ScalatraVersion = "2.2.1"
lazy val project = Project (
"the-range",
file("."),
settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ scalateSettings ++ Seq(
organization := Organization,
name := Name,
version := Version,
scalaVersion := ScalaVersion,
resolvers += Classpaths.typesafeReleases,
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % ScalatraVersion,
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
"ch.qos.logback" % "logback-classic" % "1.0.6" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.8.v20121106" % "compile;container",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "compile;container;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar"))
),
scalateTemplateConfig in Compile <<= (sourceDirectory in Compile){ base =>
Seq(
TemplateConfig(
base / "webapp" / "WEB-INF" / "templates",
Seq.empty, /* default imports should be added here */
Seq(
Binding("context", "_root_.org.scalatra.scalate.ScalatraRenderContext", importMembers = true, isImplicit = true)
), /* add extra bindings here */
Some("templates")
)
)
}
) ++ seq(com.typesafe.startscript.StartScriptPlugin.startScriptForClassesSettings: _*)
)
}
When using the markdown filter, you need to add the scalamd library as runtime dependency:
"org.fusesource.scalamd" %% "scalamd" % "1.6"
The most recent version can be found on Maven Central
Also you can delete the build.sbt file and put the dependencies into build.scala file which makes things a bit simpler.
import sbt._
import Keys._
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import com.mojolly.scalate.ScalatePlugin._
import ScalateKeys._
object TheRangeBuild extends Build {
val Organization = "com.gastove"
val Name = "The Range"
val Version = "0.1.0-SNAPSHOT"
val ScalaVersion = "2.10.0"
val ScalatraVersion = "2.2.1"
lazy val project = Project(
"the-range",
file("."),
settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ scalateSettings ++ Seq(
organization := Organization,
name := Name,
version := Version,
scalaVersion := ScalaVersion,
resolvers += Classpaths.typesafeReleases,
libraryDependencies ++= Seq( // adding this Seq to the libraryDependencies
"org.scalatra" %% "scalatra" % ScalatraVersion,
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
"ch.qos.logback" % "logback-classic" % "1.0.6" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.8.v20121106" % "compile;container",
"org.scalatest" %% "scalatest" % "2.0.M5b" % "test",
"org.twitter4j" % "twitter4j-core" % "3.0.3",
"org.fusesource.scalamd" % "scalamd" % "1.6",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "compile;container;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar"))
),
scalateTemplateConfig in Compile <<= (sourceDirectory in Compile){ base =>
Seq(
TemplateConfig(
base / "webapp" / "WEB-INF" / "templates",
Seq.empty, /* default imports should be added here */
Seq(
Binding("context", "_root_.org.scalatra.scalate.ScalatraRenderContext", importMembers = true, isImplicit = true)
), /* add extra bindings here */
Some("templates")
)
)
}
) ++ seq(com.typesafe.startscript.StartScriptPlugin.startScriptForClassesSettings: _*)
)
}
This comes from:
libraryDependencies += "org.fusesource.scalamd" % "scalamd" % "1.5"
Looking at the scalamd-1.5 pom.xml, it is built against Scala 2.8.1, which is not compatible with 2.10.
Dependency resolution keeps 2.10 and discard the 2.8.1 dependency, and you end up with this classpath issue.
The only solution you have is to try and build a new scalamd version against Scala 2.10, potentially fix a few things to get it there, and then publish it (at least locally).