EzDevInfo.com

xsbt-web-plugin

Build J2EE Web applications in Scala. xsbt-web-plugin

Request log in console for Jetty container using xsbt-web-plugin

I'm using the xsbt-web-plugin to develop a webservice.

For easier debugging I would like to switch on request logs in console like the line below.

[22/Dez/2012:15:29:56 +0000] "GET /messages HTTP/1.1" 200 27276

In production I'm using NCSARequestLog which is fine, but in development I would like to include the log in my sbt console where I started the container via container:start/

How can I enable the request logs?


Source: (StackOverflow)

Configuring xsbt-web-plugin to open JMX and allow MBean inspection with JConsole/VisualVM

How can I configure xsbt-web-plugin to open JMX port so I can inspect MBeans with Jconsole or VisualVM?

With my current setup VisualVM displays no MBean saying "the JMX connection could not be established".

I'm guessing the desired result would be xsbt-web-plugin invokes jetty in the lines of:

java
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.port=1099 
-jar start.jar etc/jetty-jmx.xml etc/jetty.xml

Source: (StackOverflow)

Advertisements

Auto-reloading files in Scala/Lift/SBT .11?

In SBT .7, you could do

~jetty-run

in order to get your files to auto compile and reload the web app whenever something changes. In SBT .11, You can do

~container:start

which also re-compiles files, but does not seem to reload the web app, everytime something changes. Rather, I have to do a

container:stop
container:start

to see the changes. The problem with this is that it takes ~30s for the it all to restart. Is there a better way of doing it? Digging through google and SBT has not found me any answers

EDIT: doing a

container:start
container:reload

each time something changes, seems to work well. However, is it possible to make it happen automatically in that sequence? Something like:

~(container:start, container:reload)

which doesn't work, but i wish it did


Source: (StackOverflow)

How can I deploy a web app with sbt 0.11?

it seems that both the jetty-run and jetty commands are missing from SBT 0.11. Either that or I am doing something very wrong. I am simply running sbt, then trying to run jetty-run. I have defined a web.xml file in src/main/webapp/WEB-INF/web.xml which contains the following information:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"> </web-app>

I am simply trying to deploy a blank web-app using the latest SBT. I cannot find any documentation or updated examples for doing so. Any ideas?

Thank you in advance.


Source: (StackOverflow)

sbt web plugin: Not a valid key: jetty-run (similar: jetty-port, jetty-context, run)

I'm trying to set up a scala sbt project with the lift web framework. I'm using

  • scala 2.9.0-1
  • sbt 0.10.1
  • lift 2.3
  • xsbt-web-plugin 0.1.1 (which is only on scala 2.8.1, see end of question)

(quite recent versions I know). I followed http://d.hatena.ne.jp/k4200/20110711/1310354698 and https://github.com/siasia/xsbt-web-plugin/blob/master/README.md to obtain the following sbt configuration files:

project/build.properties

sbt.version=0.10.1

project/plugins/build.sbt

resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"

libraryDependencies <+= sbtVersion(v => "com.github.siasia" % "xsbt-web-plugin_2.8.1" % ("0.1.1-"+v))

project/Build.scala

import sbt._
import Keys._

object BuildSettings {
  val buildOrganization = "xbaz"
  val buildScalaVersion = "2.9.0-1"
  val buildVersion      = "0.0.1"

  val buildSettings = Defaults.defaultSettings ++ Seq (
    organization := buildOrganization,
    scalaVersion := buildScalaVersion,
    version      := buildVersion)
}

object Resolvers {
  val webPluginRepo = "Web plugin repo" at "http://siasia.github.com/maven2"
  val jettyRepo = "Jetty Repo" at "http://repo1.maven.org/maven2/org/mortbay/jetty"
}

object Dependencies {

 // web plugin
  val webPluginDeps = Seq(
    "org.mortbay.jetty" % "jetty" % "6.1.26" % "jetty", // The last part is "jetty" not "test".
    "javax.servlet" % "servlet-api" % "2.5" % "provided->default"
  )

  val liftDeps = {
    val liftVersion = "2.3" // I'll switch to 2.3 soon!
    Seq(
      "net.liftweb" % "lift-webkit_2.8.1" % liftVersion % "compile->default",
      "net.liftweb" % "lift-mapper_2.8.1" % liftVersion % "compile->default"
    )
  }

  val scalaTest = "org.scalatest" % "scalatest_2.9.0" % "1.6.1" % "test"
  val apacheHttpClient = "org.apache.httpcomponents" % "httpclient" % "4.1.1"
  val apacheHttpCore = "org.apache.httpcomponents" % "httpcore" % "4.1.1"

  // Logging
  lazy val grizzled = "org.clapper" % "grizzled-slf4j_2.8.1" % "0.5"
  lazy val junit = "junit" % "junit" % "4.8" % "test"
  lazy val logback_core = "ch.qos.logback" % "logback-core" % "0.9.24" % "compile" //LGPL 2.1
  lazy val logback_classic = "ch.qos.logback" % "logback-classic" % "0.9.24" % "compile" //LGPL 2.1
  lazy val log4j_over_slf4j = "org.slf4j" % "log4j-over-slf4j" % "1.6.1"


  val logDeps = Seq(grizzled, log4j_over_slf4j, logback_core, logback_classic)
}


object MyBuild extends Build {
  import com.github.siasia.WebPlugin._ // web plugin
  import BuildSettings._
  import Dependencies._
  import Resolvers._

  //End dependencies

  lazy val root = Project("root", file(".") , settings = buildSettings ++
    Seq( name := "foo")
  ) aggregate(core, cli, web)
    //  mainClass:= Some("Main"))

  lazy val core : Project = Project("core", file("core"), delegates = root :: Nil, settings = buildSettings ++
    Seq(
    name := "foo-core",
    libraryDependencies ++= logDeps ++ Seq(scalaTest, apacheHttpClient, apacheHttpCore)
    )
  )

  lazy val cli: Project = Project("cli", file("cli"), settings = buildSettings ++ 
    Seq(
    name := "foo-cli",
    libraryDependencies ++= logDeps ++ Seq(apacheHttpClient),
    fork in run := true,
    javaOptions in run += "-Djava.library.path=/home/jolivier/Projets/asknow/lib/jnotify-lib-0.93"
  )) dependsOn(core) settings(
  )

  lazy val web: Project = Project("web", file("web"), settings = buildSettings ++
    Seq (resolvers := Seq(webPluginRepo, jettyRepo),
    name := "foo-http",
    libraryDependencies ++= logDeps ++ webPluginDeps ++ liftDeps
    ) ++ 
    webSettings
  ) dependsOn(core)
}

When I try sbt jetty-run I get the following error message:

[error] Not a valid command: jetty-run
[error] Not a valid project ID: jetty-run
[error] Not a valid configuration: jetty-run
[error] Not a valid key: jetty-run (similar: jetty-port, jetty-context, run)
[error] jetty-run
[error]

So I noticed that some jetty-* commands do exist, but not the one I want, so I printed webSettings which is supposed to contain all these new settings and it contains jetty-context and jetty-port, as well as jetty-configuration and others, but not jetty-run :s.

What did I go wrong to not have jetty-run?

I tried switching to scala-2.8.1 since the web plugin is currently only on scala 2.8.1, by changing my buildScalaVersion variable but that didn't change anything. Do you have any idea?

Thanks in advance for your help


Source: (StackOverflow)

Handling container stop/reload event

A have lift app starting ssh daemon in Boot.scala. Here is the problem: when i run container:restart / in sbt session I get Address alread in use exception. Now two questions:

  1. Is it right way to start dependent service in Boot.scala?
  2. Anyway how is it possible to handle container:stop event?

Source: (StackOverflow)

sbt, jetty and classpath

I'm trying to use the SBT with the xsbt-web-plugin. Followed the instructions on the projects website but continue to get the following (sorry for the length)

sbt.JettyRunException: Jetty and its dependencies must be on the jetty classpath
    at sbt.JettyRunner.runError(WebApp.scala:72)
    at sbt.JettyRunner.apply(WebApp.scala:62)
    at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
    at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
    at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
    at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
    at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
    at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
    at sbt.Command$.process(Command.scala:91)
    at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
    at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
    at sbt.State$$anon$1.process(State.scala:60)
    at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
    at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
    at sbt.MainLoop$.next(Main.scala:86)
    at sbt.MainLoop$.run(Main.scala:81)
    at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:75)
    at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:72)
    at sbt.Using.apply(Using.scala:25)
    at sbt.MainLoop$.runLogged(Main.scala:72)
    at sbt.MainLoop$.runLogged(Main.scala:62)
    at sbt.xMain.run(Main.scala:33)
    at xsbt.boot.Launch$.run(Launch.scala:54)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
    at xsbt.boot.Launch$.launch(Launch.scala:68)
    at xsbt.boot.Launch$.apply(Launch.scala:14)
    at xsbt.boot.Boot$.runImpl(Boot.scala:24)
    at xsbt.boot.Boot$.main(Boot.scala:15)
    at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/webapp/WebAppClassLoader
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at sbt.ModuleUtilities$.getObject(ModuleUtilities.scala:10)
    at sbt.JettyRunner.createRunner$1(WebApp.scala:45)
    at sbt.JettyRunner.runJetty$1(WebApp.scala:47)
    at sbt.JettyRunner.apply(WebApp.scala:57)
    at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
    at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
    at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
    at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
    at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
    at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
    at sbt.Command$.process(Command.scala:91)
    at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
    at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
    at sbt.State$$anon$1.process(State.scala:60)
    at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
    at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
    at sbt.MainLoop$.next(Main.scala:86)
    at sbt.MainLoop$.run(Main.scala:81)
    at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:75)
    at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:72)
    at sbt.Using.apply(Using.scala:25)
    at sbt.MainLoop$.runLogged(Main.scala:72)
    at sbt.MainLoop$.runLogged(Main.scala:62)
    at sbt.xMain.run(Main.scala:33)
    at xsbt.boot.Launch$.run(Launch.scala:54)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
    at xsbt.boot.Launch$.launch(Launch.scala:68)
    at xsbt.boot.Launch$.apply(Launch.scala:14)
    at xsbt.boot.Boot$.runImpl(Boot.scala:24)
    at xsbt.boot.Boot$.main(Boot.scala:15)
    at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.webapp.WebAppClassLoader
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at sbt.classpath.DualLoader.loadClass(DualLoader.scala:29)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at sbt.classpath.LazyFrameworkLoader.doLoadClass(ClassLoaders.scala:122)
    at sbt.classpath.LoaderBase.loadClass(ClassLoaders.scala:21)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at sbt.ModuleUtilities$.getObject(ModuleUtilities.scala:10)
    at sbt.JettyRunner.createRunner$1(WebApp.scala:45)
    at sbt.JettyRunner.runJetty$1(WebApp.scala:47)
    at sbt.JettyRunner.apply(WebApp.scala:57)
    at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:129)
    at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$$anonfun$jettyRunAction$1.apply(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$.withCurrentRef(WebPlugin.scala:138)
    at com.github.siasia.WebPlugin$.jettyRunAction(WebPlugin.scala:133)
    at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
    at com.github.siasia.WebPlugin$$anonfun$10.apply(WebPlugin.scala:141)
    at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
    at sbt.Command$$anonfun$command$1$$anonfun$apply$1.apply(Command.scala:33)
    at sbt.Command$.process(Command.scala:91)
    at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
    at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:86)
    at sbt.State$$anon$1.process(State.scala:60)
    at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
    at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:86)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
    at sbt.MainLoop$.next(Main.scala:86)
    at sbt.MainLoop$.run(Main.scala:81)
    at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:75)
    at sbt.MainLoop$$anonfun$runLogged$1.apply(Main.scala:72)
    at sbt.Using.apply(Using.scala:25)
    at sbt.MainLoop$.runLogged(Main.scala:72)
    at sbt.MainLoop$.runLogged(Main.scala:62)
    at sbt.xMain.run(Main.scala:33)
    at xsbt.boot.Launch$.run(Launch.scala:54)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
    at xsbt.boot.Launch$.launch(Launch.scala:68)
    at xsbt.boot.Launch$.apply(Launch.scala:14)
    at xsbt.boot.Boot$.runImpl(Boot.scala:24)
    at xsbt.boot.Boot$.main(Boot.scala:15)
    at xsbt.boot.Boot.main(Boot.scala)
[error] sbt.JettyRunException: Jetty and its dependencies must be on the jetty classpath
[error] Use 'last' for the full log.

Here's my config: In project/plugins.sbt:

resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"    

addSbtPlugin("com.github.siasia" %% "xsbt-web-plugin" % "0.1.2")

libraryDependencies += "org.eclipse.jetty" % "jetty-server" % "8.0.1.v20110908"

Here's my build.sbt:

name := "Project Manager"

scalaVersion := "2.9.1"

resolvers += "repo.codahale.com" at "http://repo.codahale.com"

libraryDependencies ++= Seq(
    "org.scalatra" %% "scalatra" % "2.0.1",
    "org.scalatra" %% "scalatra-scalate" % "2.0.1",
    "javax.servlet" % "servlet-api" % "2.4",
    "org.slf4j" % "slf4j-simple" % "1.6.2",
    "postgresql" % "postgresql" % "9.0-801.jdbc4",
    "com.codahale" % "jerkson_2.9.1" % "0.4.2",
    "org.eclipse.jetty" % "jetty-server" % "8.0.1.v20110908"
)

seq(webSettings :_*)

Any help would be greatly appreciated!


Source: (StackOverflow)

deploy scalatra app on heroku error plugin not found

I followed the guide of deploying a Scalatra app on Heroku [lien] http://www.scalatra.org/guides/deployment/heroku.html#toc_177 and I get the following error:

  > [error] (*:update) sbt.ResolveException: unresolved dependency: >com.typesafe.startscript#xsbt-start-script-plugin;0.5.3: not found 

My version of SBT is 0.13.0..

For information I'm debutante with scalatra and sbt,Please can you help me..


Source: (StackOverflow)

lift does not build with sbt?

i am following the steps for sbt 0.10 on assembla lift wiki and get the following error:

[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.mpeltonen#sbt-idea_2.8.1;0.10.0-SNAPSHOT: not found
[warn] :: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info]

probably because both pages: http://siasia.github.com/maven2 and http://mpeltonen.github.com/maven/ are not existing ? my build.sbt:

name := "MyWeb"

scalaVersion := "2.9.0"

seq(WebPlugin.webSettings: _*)

resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
resolvers += "Web plugin repo2" at "http://mpeltonen.github.com/maven/"


libraryDependencies ++= {

  val liftVersion = "2.4-M1"

  Seq(
    "net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-mapper" % liftVersion % "compile->default",
    "net.liftweb" %% "lift-wizard" % liftVersion % "compile->default"
  )

} 

libraryDependencies ++= Seq(
  "junit" % "junit" % "4.5" % "test->default",
  "org.mortbay.jetty" % "jetty" % "6.1.22" % "jetty",
  "javax.servlet" % "servlet-api" % "2.5" % "provided->default",
  "com.h2database" % "h2" % "1.2.138",
  "ch.qos.logback" % "logback-classic" % "0.9.26" % "compile->default"
)

and plugins/build.sbt:

resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"

libraryDependencies <+= sbtVersion("com.github.siasia" %% "xsbt-web-plugin" % _)

So what am i doing wrong?

Thanks for any help!


Source: (StackOverflow)

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.


Source: (StackOverflow)

How to configure build.sbt so that xsbt-web-plugin a creates war file without compression?

I am using Scala 2.10.1 with sbt to package my webapp as a war file. For the purpose of efficient rsync deltas, I'd like to have the war packaged as a .war file, but without zip compression. I just need to know how to configure my build for this.

UPDATE:
All these plugin docs assume all this knowledge of how the syntax works and how to combine tasks into a new task, etc. I can't even tell how to create a new task that does package then command. None of the answers so far have said specifically, "here's what you do.."

Just to be clear, this is all I'm asking for:

I need a Task "packnozip" that does this:

1) run "package"

2) run shell commands:

$ mkdir ./Whatever 
$ pushd ./Whatever 
$ jar xvf ../Whatever.war 
$ popd 
$ mv ./Whatever.war ./Whatever.war.orig 
$ jar cvM0f ./Whatever.war -C ./Whatever . 

So what i'm saying is i want to type "packnozip" into the sbt console and have it do #1 then #2.

For now i'm just manually doing #2 which seems silly if it can be automated. Also watching a 30MB file get completely resent by rsync b/c it is not diffable seems quite silly when a 34MB uncompressed file is only 13% more data, and takes a fraction of second to send b/c of efficient diffs, not to mention "-z" will compress the transfer anyways.


Source: (StackOverflow)

Overriding jetty port setting when using Build.scala files

I am moving my build from build.sbt to Build.scala files and I am having trouble overriding the jetty port setting when using the xsbt-web-plugin. When using build.sbt I was able to set the property using:

port in container.Configuration := 8081

In my .scala files I have tried a few things but jetty is always starting on 8080 for example in my BuildSettings object:

import sbt._
import Keys._
import com.earldouglas.xsbtwebplugin.PluginKeys._
object BuildSettings {
  lazy val settings =  com.earldouglas.xsbtwebplugin.WebPlugin.webSettings ++ seq(
    ...
    port := 8081,
    ...
  ) 
}

I have also tried overriding it in the Project definition in Build.scala:

  lazy val root = Project("test",file("."))
    .settings(settings: _*)
    .settings(port := 8081)

But it always starts on 8080. In both of these cases running show port shows 8081.


Source: (StackOverflow)

sbt 0.11.2 how to combine ~copy-resources with ~aux-compile

I'm using sbt 0.11.2 with xsbt-web-plugin 0.2.10 to build a Wicket (1.5.3) app. I'm using this version of Jetty:

"org.eclipse.jetty" % "jetty-webapp" % "8.0.1.v20110908" % "container",

So when I do

> container:start

my app starts up just fine.

But if I change some some of the html, the change does not kick in until I do

> copy-resources

and scala source code changes are not reflected until I do

> aux-compile
(this one was hard to find out!!)

The problem is that I want this to be reflected immediately. I can do

> ~ copy-resources

or

> ~ aux-compile    

separately so that one or the other will happen on save automatically.

The problem is that I don't see any obvious way to do both because I can't enter a 2nd tilde-prefixed command without pressing the enter key first to get the command prompt, and that cancels the running tilde command.

Thanks.


UPDATE:
I posted a minimal example of what I'm trying to do here:
https://github.com/jpswain/DummySbtScalaWicket.git

I fire this up by running sbt (0.11.2), and then doing

> container:start

So you will notice that if you do "~aux-compile" and change a log statement, or change the name that is read by the label, that will be updated on the fly. If you do "~copy-resources" and change "Hello" -> "Hola" you will see that changed on the fly. I'm trying to make it so that both will be done on save. "~container:reload /" seems to do nothing!

The answer from @Vasil Remeniuk seems like the right approach, except I haven't figure out exactly where to put the code to make it work. (I get a syntax error.) It would be great if someone would please verify if that code will work, or if I'm doing something wrong with my project that would prevent it from working?

Thanks!!
Jamie


FINAL UPDATE:
Thanks to the advice from @Vasil Remeniuk I got all this working. If anyone needs it for a quickstart to work with reloadable Jetty container, just download it at https://github.com/jpswain/DummySbtScalaWicket.git
and then from the directory run:

$ sbt

once sbt comes up, do this:

> container:start
> ~auxx

Source: (StackOverflow)

how to set the contextPath of jetty on xsbt-web-plugin?

I'm on sbt 0.11.1 and xsbt-web-plugin 0.2.10

here goes the build.sbt and plugins.sbt

build.sbt

organization := "org"

name := "demo"

version := "0.1.0-SNAPSHOT"

scalaVersion := "2.9.1"

seq(webSettings :_*)

configurationXml := 
                    <configuration>
                        <webApp>
                          <contextPath>/foo</contextPath>
                        </webApp>
                    </configuration>

libraryDependencies ++= Seq(
  "org.eclipse.jetty" % "jetty-webapp" % "7.4.5.v20110725" % "container",
  "javax.servlet" % "servlet-api" % "2.5" % "provided"
)

resolvers += "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"

project/plugins.sbt

libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.10"))

It seems the configurationXml doesn't work, after running container:start in sbt console, the contextPath gets the default value "/"

how can I change the contextPath? any tips? thanks in advance!


Source: (StackOverflow)

How can I tell sbt to exclude files from the WAR but allow them to be loaded by container:start?

I have an an sbt 11.0 project that I originally wrote again xsbt-web-plugin 0.1.x. Against that version I was able to use the following line to cause some files not to be included in the WAR but to be loaded when I did jetty-run.

WebPlugin.webappUnmanaged <<= WebPlugin.temporaryWarPath{twp => (twp / "api" / "1" / "javascript" / "test" * "*") }

In xsbt-web-plugin version 0.2.x there isn't a WebPlugin.webappUnmanaged key. Do you know how I could accomplish the same thing with the new version?

So in case it wasn't clear, what I'm trying to do is load some test JavaScript when I'm running Jetty from within SBT, but I want to exclude those files from the artifact produced by package-war so that the test files don't go to production.


Source: (StackOverflow)