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

1

6

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.

Sanctified answered 7/10, 2011 at 1:46 Comment(2)
Thought it's only a workaround, did you consider to move xsbt-web-plugin dependency to the full build configuration (project/TaskTrackerBuild.scala)? I'm in doubt, it's good (not to say, safe) way to have short and full configs coexisting.Isidore
Actually there had being a bug in xsbt-web-plugin https://github.com/siasia/xsbt-web-plugin/issues/40. Now is is fixed and my sbt build is working fine.Sanctified
H
1

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.

Helainehelali answered 8/10, 2011 at 10:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.