Play subproject can't import Play-json classes on IntelliJ - scala

I've split my app into sub-projects for better organization, however. My core sub-module which is a play app can't import play.api.libs.json.Json
Here is my build.sbt
# project/Common.scala
import sbt._
import sbt.Keys._
object Common {
val settings = Seq(
organization := "com.company.app",
scalaVersion := "2.12.5"
)
val dependencies = new {
val macwireVersion = "2.3.0"
val reactiveMongoVersion = "0.13.0-play26"
val slickVersion = "3.0.3"
val postgresVersion = "42.2.2"
val scalatestPlayVersion = "3.1.2"
val macwire = "com.softwaremill.macwire" %% "macros" % macwireVersion % "provided"
val reactivemongo = "org.reactivemongo" %% "play2-reactivemongo" % reactiveMongoVersion
val slick = "com.typesafe.play" %% "play-slick" % slickVersion
val slickEvolutions = "com.typesafe.play" %% "play-slick-evolutions" % slickVersion
val postgresql = "org.postgresql" % "postgresql" % postgresVersion
val scalatestPlay = "org.scalatestplus.play" %% "scalatestplus-play" % scalatestPlayVersion % Test
}
lazy val commonDependencies = Seq(
dependencies.macwire,
dependencies.reactivemongo,
dependencies.slick,
dependencies.slickEvolutions,
dependencies.postgresql,
dependencies.scalatestPlay
)
}
# build.sbt
lazy val core = (project in file("modules/core"))
.enablePlugins(PlayScala)
.settings(
name := "app-core",
libraryDependencies ++= Common.commonDependencies ++ Seq(
),
Common.settings
)
lazy val cms = (project in file("modules/cms"))
.enablePlugins(PlayScala)
.settings(
name := "app-cms",
libraryDependencies ++= Common.commonDependencies,
Common.settings
)
.dependsOn(core % "test->test;compile->compile")
.aggregate(core)
lazy val api = (project in file("modules/api"))
.enablePlugins(PlayScala)
.settings(
name := "app-api",
libraryDependencies ++= Common.commonDependencies,
Common.settings
)
.dependsOn(core % "test->test;compile->compile")
.aggregate(core)
lazy val reporting = (project in file("modules/reporting"))
.enablePlugins(PlayScala)
.settings(
name := "app-reporting",
libraryDependencies ++= Common.commonDependencies,
Common.settings
)
.dependsOn(core % "test->test;compile->compile")
.aggregate(core)
lazy val backend = (project in file("."))
.enablePlugins(PlayScala)
.settings(
name := "app-backend",
libraryDependencies ++= Common.commonDependencies
)
.dependsOn(
core % "test->test;compile->compile",
cms,
api,
reporting
)
.aggregate(cms, api, reporting)
I can't add an implicit Json format for My model User in the core module.
For the backend app, I can import w/o issues, is there something I'm missing here in the submodule part?
Thanks,

Double check if you are actually importing the play-json library because in Play 2.6 it is a standalone library:
libraryDependencies += "com.typesafe.play" %% "play-json" % playVersion

Related

How to reference a project definition in a parent build.sbt file?

I'm playing around with the scala-forklift library and wanted to test an idea by modifying the code in the library and example project.
This is how the project is structured:
/build.sbt -> Contains definition of scala-forklift-slick project (including its dependencies) in the form of:
lazy val slickMigrationProject =
Project("scala-forklift-slick", file(...))
.dependsOn(...)
.settings(...)
...
/example/build.sbt -> References scala-forklift-slick via its Maven package.
My goal is to replace the scala-forklift-slick Maven package reference with a reference to the code in the parent directory, perhaps via .dependsOn(slickMigrationProject)?
Attempts:
According to the documentation:
Any .sbt files in foo, say foo/build.sbt, will be merged with the build definition for the entire build, but scoped to the hello-foo project.
But this does not seem to apply to lazy val values, as I can't access slickMigrationProject from the parent project directly.
I have been successful copying the entire contents of /example/build.sbt into /build.sbt and tweaking things a bit, but I was wondering if there was a better "one-liner" kind of solution instead.
Here is what my combined /build.sbt file looks like:
val repoKind = SettingKey[String]("repo-kind",
"Maven repository kind (\"snapshots\" or \"releases\")")
lazy val slickVersion = "3.3.3"
lazy val scala212 = "2.12.11"
lazy val scala213 = "2.13.1"
lazy val supportedScalaVersions = List(scala212, scala213)
lazy val coreDependencies = libraryDependencies ++= List(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"com.typesafe" % "config" % "1.3.2",
"org.eclipse.jgit" % "org.eclipse.jgit" % "4.0.1.201506240215-r"
)
lazy val slickDependencies = List(
"com.typesafe.slick" %% "slick" % slickVersion,
"com.typesafe.slick" %% "slick-codegen" % slickVersion,
"io.github.nafg" %% "slick-migration-api" % "0.7.0",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.0.0"
)
lazy val slickDependenciesWithTests = slickDependencies ++ List(
"org.scalatest" %% "scalatest" % "3.1.0",
"com.lihaoyi" %% "ammonite-ops" % "2.0.4",
"commons-io" % "commons-io" % "2.6",
"com.typesafe.slick" %% "slick-hikaricp" % slickVersion,
"com.h2database" % "h2" % "1.4.200",
"org.xerial" % "sqlite-jdbc" % "3.8.11.2",// 3.30.1 crashes SQLiteCommandTests
"mysql" % "mysql-connector-java" % "5.1.38",
"org.postgresql" % "postgresql" % "42.2.9",
"org.hsqldb" % "hsqldb" % "2.5.0",
"org.apache.derby" % "derby" % "10.14.2.0",
"ch.qos.logback" % "logback-classic" % "1.2.3"
).map(_ % "test")
lazy val commonSettings = Seq(
organization := "com.liyaos",
licenses := Seq("Apache 2.0" ->
url("https://github.com/lastland/scala-forklift/blob/master/LICENSE")),
homepage := Some(url("https://github.com/lastland/scala-forklift")),
scalaVersion := scala213,
scalacOptions += "-deprecation",
scalacOptions += "-feature",
resolvers += Resolver.jcenterRepo,
publishMavenStyle := true,
publishArtifact in Test := false,
repoKind := { if (version.value.trim.endsWith("SNAPSHOT")) "snapshots"
else "releases" },
publishTo := { repoKind.value match {
case "snapshots" => Some("snapshots" at
"https://oss.sonatype.org/content/repositories/snapshots")
case "releases" => Some("releases" at
"https://oss.sonatype.org/service/local/staging/deploy/maven2")
}},
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
pomExtra := (
<scm>
<url>git#github.com:lastland/scala-forklift.git</url>
<connection>scm:git:git#github.com:lastland/scala-forklift.git</connection>
</scm>
<developers>
<developer>
<id>lastland</id>
<name>Yao Li</name>
</developer>
</developers>))
// Derby is running is secured mode since version 10.12.1.1, so security manager must be disabled for tests
// https://stackoverflow.com/questions/48008343/sbt-test-does-not-work-for-spark-test
// https://issues.apache.org/jira/browse/DERBY-6648
Test / testOptions += Tests.Setup(() => System.setSecurityManager(null))
lazy val root = Project(
"scala-forklift", file(".")).settings(
crossScalaVersions := Nil,
publishArtifact := false).aggregate(
coreProject, slickMigrationProject, plainMigrationProject, gitToolProject, example)
lazy val coreProject = Project(
"scala-forklift-core", file("core")).settings(
commonSettings:_*).settings {Seq(
crossScalaVersions := supportedScalaVersions,
coreDependencies
)}
lazy val slickMigrationProject = Project(
"scala-forklift-slick", file("migrations/slick")).dependsOn(
coreProject).settings(commonSettings:_*).settings { Seq(
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= slickDependenciesWithTests
)}
lazy val plainMigrationProject = Project(
"scala-forklift-plain", file("migrations/plain")).dependsOn(
coreProject).settings(commonSettings:_*).settings(crossScalaVersions := supportedScalaVersions)
lazy val gitToolProject = Project(
"scala-forklift-git-tools", file("tools/git")).dependsOn(
coreProject).settings(commonSettings:_*).settings(crossScalaVersions := supportedScalaVersions)
///////////////////////////////////////////////
name := "forklift-slick-example"
addCommandAlias("mgm", "example/migration_manager/run")
addCommandAlias("mg", "example/migrations/run")
lazy val exampleCommonSettings = Seq(
organization := "com.liyaos",
version := "2.0",
scalaVersion := "2.13.1",
scalacOptions += "-deprecation",
scalacOptions += "-feature",
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers += Resolver.jcenterRepo,
)
lazy val loggingDependencies = List(
"org.slf4j" % "slf4j-nop" % "1.6.4" // <- disables logging
)
lazy val exampleSlickDependencies = List(
"com.typesafe.slick" %% "slick" % slickVersion
)
lazy val dbDependencies = List(
"com.typesafe.slick" %% "slick-hikaricp" % slickVersion
,"com.h2database" % "h2" % "1.4.200"
)
lazy val forkliftDependencies = List(
// "com.liyaos" %% "scala-forklift-slick" % forkliftVersion
)
lazy val appDependencies = dbDependencies ++ loggingDependencies
lazy val migrationsDependencies =
dbDependencies ++ forkliftDependencies ++ loggingDependencies
lazy val migrationManagerDependencies = dbDependencies ++ forkliftDependencies
lazy val example = Project("example", file("example")).aggregate(
app, migrations, migrationManager, generatedCode, tools).settings(
exampleCommonSettings:_*)
lazy val app = Project("app", file("example/app"))
.dependsOn(generatedCode)
.settings(exampleCommonSettings:_*)
.settings {libraryDependencies ++= appDependencies}
lazy val migrationManager = Project("migration_manager", file("example/migration_manager"))
.dependsOn(slickMigrationProject)
.settings(exampleCommonSettings:_*)
.settings {libraryDependencies ++= migrationManagerDependencies}
lazy val migrations = Project("migrations", file("example/migrations"))
.dependsOn(generatedCode, migrationManager, slickMigrationProject)
.settings(exampleCommonSettings:_*)
.settings {libraryDependencies ++= migrationsDependencies}
lazy val tools = Project("git-tools", file("example/tools/git"))
.dependsOn(slickMigrationProject, gitToolProject)
.settings(commonSettings:_*)
.settings {
libraryDependencies ++= forkliftDependencies ++ List(
// "com.liyaos" %% "scala-forklift-git-tools" % forkliftVersion,
"com.typesafe" % "config" % "1.3.0",
"org.eclipse.jgit" % "org.eclipse.jgit" % "4.0.1.201506240215-r"
)
}
lazy val generatedCode = Project("generate_code", file("example/generated_code"))
.settings(exampleCommonSettings:_*)
.settings {libraryDependencies ++= exampleSlickDependencies}
Question:
Is there a simple way I can replace the scala-forklift-slick Maven package reference in /example/build.sbt with a link to the existing scala-forklift-slick project definition in the parent directory's build.sbt so I can use .dependsOn(...) instead?
Or maybe it's better to do something like build scala-forklift-slick and use a local disk package resolver?
Luis Miguel Mejía Suárez's comment worked perfectly and was the easier approach.
In the context of this project, all I had to do was:
Append -SNAPSHOT to the version in /version.sbt (should not be needed normally but for this project I had to do this)
Run sbt publishLocal in the parent project.
After this, the example project (which already targets the -SNAPSHOT version) is able to pick up the locally built package.

Multi Module SBT projects issues

I am working on designing a multi module project in SBT.
The idea is to build two subprojects in SBT with one subproject having Apache spark 2.3 dependency and
the other one with Apache Spark 2.4 dependency. Each sub project should be capable of building individual
jars. I am pasting the build.sbt. While I try to run sbt assembly on each of these sub projects.
I am getting the below error.I tried removing the cache folder in .ivy2 and tried
recreating the project structure.
Error message(included relevant logs only)
[IJ]> multi2/assembly
[info] Including from cache: jackson-xc-1.9.13.jar
[info] Including from cache: minlog-1.3.0.jar
[warn] Merging 'META-INF\ASL2.0' with strategy 'discard'
[warn] Merging 'META-INF\DEPENDENCIES' with strategy 'discard'
[error] C:\Users\user_home\.ivy2\cache\org.apache.spark\spark-core_2.11\jars\spark-core_2.11-2.4.3.jar:org/apache/spark/unused/UnusedStubClass.class
[error] C:\Users\user_home\.ivy2\cache\org.apache.spark\spark-launcher_2.11\jars\spark-launcher_2.11-2.4.3.jar:org/apache/spark/unused/UnusedStubClass.class
[error] C:\Users\user_home\.ivy2\cache\org.apache.spark\spark-tags_2.11\jars\spark-tags_2.11-2.4.3.jar:org/apache/spark/unused/UnusedStubClass.class
[error] C:\Users\user_home\.ivy2\cache\org.spark-project.spark\unused\jars\unused-1.0.0.jar:org/apache/spark/unused/UnusedStubClass.class
Likewise there are other classes that cause errors as above..
Please suggest, and let me know for any additional information.
name := "testrepo"
organization in ThisBuild := "com.yt"
scalaVersion in ThisBuild := "2.11.8"
scalaBinaryVersion := "2.11"
lazy val common = (project in file("common"))
.settings(
name := "common",
commonSettings,
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-core" % "2.8.7",
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7",
dependencyOverrides += "com.fasterxml.jackson.module" %% "jackson-module-scala" %
dependencyOverrides += "io.netty" % "netty" % "3.9.9.Final",
dependencyOverrides += "commons-net" % "commons-net" % "2.2",
dependencyOverrides += "com.google.guava" % "guava" % "11.0.2",
dependencyOverrides += "com.google.code.findbugs" % "jsr305" % "1.3.9",
libraryDependencies ++= commonDependencies
)
.disablePlugins(AssemblyPlugin)
lazy val multi1 = (project in file("multi1"))
.settings(
name := "multi1",
commonSettings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.spark23
)
)
.dependsOn(
common
)
lazy val multi2 = (project in file("multi2"))
.settings(
name := "multi2",
commonSettings,
assemblySettings,
libraryDependencies ++= commonDependencies ++ Seq(
dependencies.spark24
)
)
.dependsOn(
common
)
/*val overrides = Seq("com.fasterxml.jackson.core" % "jackson-core" % "2.8.7",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.8.7") */
// DEPENDENCIES
lazy val dependencies =
new {
val hivejdbc="org.apache.hive" % "hive-jdbc" % "0.13.0" % "provided"
val spark23V = "2.3.0.cloudera3"
val spark24V="2.4.3"
val spark23="org.apache.spark" %% "spark-core" % spark23V
val spark24="org.apache.spark" %% "spark-core" % spark24V
}
lazy val commonDependencies = Seq(
dependencies.hivejdbc
)
lazy val compilerOptions = Seq(
"-unchecked",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:postfixOps",
"-deprecation",
"-encoding",
"utf8"
)
lazy val commonSettings = Seq(
scalacOptions ++= compilerOptions,
resolvers ++= Seq(
"Local Maven Repository" at "file://" + Path.userHome.absolutePath + "/.m2/repository",
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
)
)
lazy val assemblySettings = Seq(
assemblyJarName in assembly := name.value + ".jar",
assemblyMergeStrategy in assembly := {
case PathList("org.apache.spark", "spark-core_2.11", xs # _*) => MergeStrategy.last
case PathList("META-INF", xs # _*) => MergeStrategy.discard
case "application.conf" => MergeStrategy.concat
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
)

How to set envVars for multiproject?

I have sbt multi projects and try to set the envVars in the build.sbt for subprojects as following:
envVars in Test := Map("KAFKA_SERVER" -> "localhost:9092")
the test abort with following message:
[info] java.util.NoSuchElementException: None.get
[info] at scala.None$.get(Option.scala:349)
[info] at scala.None$.get(Option.scala:347)
[info] at io.khinkali.auth.AppSpec.<init>(AppSpec.scala:23)
[info] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
In the test file, I tried to get the value as following:
sys.env.get("KAFKA_SERVER").get
Intellj provides the set the environment variable as following:
How to set an environment variable in sbt for subprojects also?
Update
The root build.sbt looks as following:
name := "bary"
scalacOptions += "-Ypartial-unification"
scalacOptions += "-feature"
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
val Cats = "1.0.0"
val Shiro = "1.4.0"
val Logback = "1.2.3"
val CatsEffect = "0.5"
val Kafka = "1.0.0"
val Bean = "1.9.3"
val Circe = "0.9.0-M3"
val Log4j = "1.7.25"
val ScalaCheck = "1.13.4"
val Scalactic = "3.0.4"
val Scalatest = "3.0.4"
val JavaJwt = "3.3.0"
val Simulacrum = "0.11.0"
val Http4s = "0.18.0-M7"
lazy val commonSettings = Seq(
organization := "io.khinkali",
version := "0.1.0-SNAPSHOT",
scalaVersion := "2.12.4",
envVars in Test := Map("KAFKA_SERVER" -> "localhost:9092"),
fork in Test := true,
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-simple" % Log4j,
"ch.qos.logback" % "logback-core" % Logback,
"org.apache.shiro" % "shiro-all" % Shiro,
"org.typelevel" %% "cats-core" % Cats,
"org.typelevel" %% "cats-effect" % CatsEffect,
"org.apache.kafka" % "kafka-streams" % Kafka,
"org.apache.kafka" % "kafka-clients" % Kafka,
"commons-beanutils" % "commons-beanutils" % Bean,
"io.circe" %% "circe-core" % Circe,
"io.circe" %% "circe-generic" % Circe,
"io.circe" %% "circe-parser" % Circe,
"io.circe" %% "circe-literal" % Circe,
"com.github.mpilquist" %% "simulacrum" % Simulacrum,
"org.scalactic" %% "scalactic" % Scalactic,
"org.scalatest" %% "scalatest" % Scalatest % "test",
"org.scalacheck" %% "scalacheck" % ScalaCheck % "test",
),
resolvers ++= Seq(
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
),
fork in run := true,
)
lazy val root = (project in file("."))
.settings(commonSettings)
.settings(
name := "bary",
organization := "io.khinkali",
moduleName := "bary"
).
aggregate(
kafka_api,
auth_stream,
rest)
lazy val kafka_api = (project in file("kafka-api")).
settings(commonSettings).
settings(
name := "kafka-api",
moduleName := "kafka-api"
)
lazy val auth_stream = (project in file("auth-stream")).
settings(commonSettings).
settings(
name := "auth-stream",
moduleName := "auth-stream",
libraryDependencies ++= Seq(
"com.auth0" % "java-jwt" % JavaJwt,
)
).dependsOn(kafka_api)
lazy val rest = (project in file("rest")).
settings(commonSettings).
settings(
name := "rest",
moduleName := "rest",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-dsl" % Http4s,
"org.http4s" %% "http4s-blaze-server" % Http4s,
"org.http4s" %% "http4s-blaze-client" % Http4s,
"org.http4s" %% "http4s-circe" % Http4s,
)
).dependsOn(kafka_api, auth_stream)
I still got the exception.
Any setting you want to apply to a subproject can either be specified just for that subproject or in commonSettings, as shown in build.sbt below.
You did not show your multiproject definitions, so here is a short example. There are many ways of setting up these types of projects, and I am not going to elaborate on the possible ways; this is a complicated topic, and it has evolved a lot over the years, especially recently.
lazy val commonSettings = Seq(
envVars in Test := Map("KAFKA_SERVER" -> "localhost:9092"),
fork in Test := true, // required for envVars task to work
javacOptions ++= Seq(
"-Xlint:deprecation",
"-Xlint:unchecked",
"-source", "1.8",
"-target", "1.8",
"-g:vars"
),
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html")),
version := "0.5.0"
)
lazy val demo = project
.settings(commonSettings:_*)
.settings(
name := "demo"
).dependsOn(root)
lazy val root = (project in file("root"))
.settings(commonSettings:_*)
.settings(
name := "root"
)
One more important fact: The environment setting for test will not be respected when run with the IntelliJ IDEA test runner. As a workaround, you can set environment variables in the Run/Debug Configurations -> Environment variables window. When you run sbt test, however, the environment variable specified in build.sbt will be set.
Normally, the only way to apply an environment variable to a process is to start the process with that environment variable. If you want SBT to run your program in an environment with a certain environment variable, it will need to be launched in a new environment. This is called forking.

how do you get sbt web plugin to work with a .scala config

I'm currently getting the error
Plugin classpath does not exist for plugin definition at
file:/C:/project_root/project/
from the below files.
Does anyone know how to configure the web plugin properly for a lift project with .scala config?
plugin/Build.scala:
import com.github.siasia.PluginKeys._
import com.github.siasia.WebPlugin._
import sbt._
import Keys._
object BuildSettings {
val buildOrganization = "dualitystudios"
val buildVersion = "0.1"
val buildScalaVersion = "2.9.1"
val buildSettings = Defaults.defaultSettings ++ Seq (
organization := buildOrganization,
version := buildVersion,
scalaVersion := buildScalaVersion
)
}
object Dependencies {
val liftVersion = "2.4"
val logbackVer = "0.9.26"
val lift_webkit = "net.liftweb" %% "lift-webkit" % liftVersion % "compile"
val lift_mapper = "net.liftweb" %% "lift-mapper" % liftVersion % "compile"
//val jetty = "org.mortbay.jetty" % "jetty" % "6.1.26" % "test"
val junit = "junit" % "junit" % "4.7" % "test"
val testing_tools = "org.scala-tools.testing" %% "specs" % "1.6.9" % "test"
val logbackclassic = "ch.qos.logback" % "logback-classic" % logbackVer
val dbConnector = "com.h2database" % "h2" % "1.2.147"
val selenium = "org.seleniumhq.selenium" % "selenium-java" % "2.21.0"
val mysql = "mysql" % "mysql-connector-java" % "5.1.19"
val jetty = "org.mortbay.jetty" % "jetty" % "6.1.22" % "test"
val liftAuth = RootProject(uri("git://github.com/keynan/LiftAthentication.git"))
}
object Resolvers {
val scala_testing = "Scala Testing" at "http://mvnrepository.com/artifact"
def resolve_all = Seq(scala_testing)
}
object LiftProject extends Build {
import Dependencies._;
import BuildSettings._;
import Resolvers._;
lazy val JavaNet = "Java.net Maven2 Repository" at "http://download.java.net/maven/2/"
//lazy val sbtWeb = uri("git://github.com/siasia/xsbt-web-plugin")
lazy val main = Project (
"xxxxxx",
file ("."),
settings = buildSettings ++ Seq (
resolvers := resolve_all,
libraryDependencies ++= Seq(
lift_webkit,
lift_mapper,
jetty,
junit,
testing_tools,
logbackclassic,
dbConnector,
selenium,
mysql
)
) ++ webSettings
) dependsOn(liftAuth)
}
project/project/Build.scala:
import sbt._
import Keys._
object PluginDef extends Build {
val jetty = "org.mortbay.jetty" % "jetty" % "6.1.22"
override lazy val projects = Seq(root)
lazy val root = Project(
"plug",
file("."),
settings = Seq(
libraryDependencies ++= Seq(jetty))
) dependsOn( sbtWeb )
lazy val sbtWeb = uri("git://github.com/siasia/xsbt-web-plugin")
}
Replace your ./project/project/Build.scala with ./project/plugins.sbt containing:
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.11"))

SBT Web Plugin : Error getting ScopedKey(Scope(This,Select(ConfigKey(container)),This,This),full-classpath)

I'm trying to set up scala web project with sbt. I've following settings.
scala 2.9.0-1
sbt 0.11.0
xsbt-web-plugin 0.2.1
project/plugins.sbt
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.1"))
project/TaskTrackerBuild.scala
import sbt._
import com.github.siasia._
import WebPlugin._
import PluginKeys._
import Keys._
/**
* Main sbt build file for the task-tracker project.
*
*/
object TicketingCoreProject extends Build {
val ticketingVersion = "1.0.0-SNAPSHOT"
val Organization = "org.sansoft"
val ScalaVersion = "2.9.0-1"
val jodaTime = "joda-time" % "joda-time" % "1.6"
val scalaTime = "org.scala-tools.time" % "time_2.8.0" % "0.2"
val casbah = "com.mongodb.casbah" % "casbah_2.9.0-1" % "2.1.5.0"
val Slf4jLog4jDep = "org.slf4j" % "slf4j-log4j12" % "1.6.1"
val ScalaCheckDep = "org.scala-tools.testing" %% "scalacheck" % "1.9" % "test"
val JUnitDep = "junit" % "junit" % "4.8.2" % "test"
val scalaTesting = "org.scala-tools.testing" %% "specs" % "1.6.8" % "test"
//val scctSbt = "ch.craven" %% "scct-plugin" % "0.2"
val vaadin = "com.vaadin" % "vaadin" % "6.7.0"
val jettyWebApp = "org.eclipse.jetty" % "jetty-webapp" % "7.3.0.v20110203" % "container"
val jettyPlus = "org.eclipse.jetty" % "jetty-plus" % "7.3.0.v20110203" % "container"
val repositories = Seq(
ScalaToolsSnapshots,
"typesafe releases" at "http://repo.typesafe.com/typesafe/releases",
"typesafe snapshots" at "http://repo.typesafe.com/typesafe/snapshots",
"scct-repo" at "http://mtkopone.github.com/scct/maven-repo")
def publishToRepository = Some(Resolver.file("Local Maven Repository", Path.userHome / ".m2" / "repository" asFile))
lazy val baseSettings = Defaults.defaultSettings ++ Seq(
version := ticketingVersion,
organization := Organization,
scalaVersion := ScalaVersion,
publishMavenStyle := true,
publishTo := publishToRepository,
resolvers ++= repositories,
checksums := Nil
)
lazy val parent = Project("taskTrackerParent", file("."),
settings = baseSettings ++ Seq(
name := "task-tracker-parent"
))
lazy val core = Project("core", file("core"),
settings = baseSettings ++ Seq(
name := "core",
libraryDependencies ++= Seq(
jodaTime,
scalaTime,
scalaTesting,
ScalaCheckDep,
casbah,
jodaTime,
scalaTime)))
lazy val web = Project("web", file("web"),
settings = baseSettings ++ webSettings ++ Seq(
name := "web",
libraryDependencies ++= Seq(
jodaTime,
scalaTime,
scalaTesting,
ScalaCheckDep,
casbah,
jodaTime,
scalaTime,
vaadin,
jettyWebApp,
jettyPlus))) dependsOn(core)
}
When I try to start sbt with this build file I get following error.
[error] Error getting ScopedKey(Scope(This,Select(ConfigKey(container)),This,This),full-classpath)
[error] Use 'last' for the full log.
If I remove the configuration webSettings from the web project sbt project compiles fine.
What have I done wrong in this???
Thanks in advance.
I had exactly the same issue when I tried to use webSettings.
Today I found a solution on project-doc:
https://github.com/siasia/xsbt-web-plugin/wiki/Deployment-scenarios
The plugin works when I change from webSettings to webAppSettings.