Skip to content

Instantly share code, notes, and snippets.

@alexarchambault
Last active August 29, 2015 14:13
Show Gist options
  • Save alexarchambault/6fea21dffbf2a1fc48b0 to your computer and use it in GitHub Desktop.
Save alexarchambault/6fea21dffbf2a1fc48b0 to your computer and use it in GitHub Desktop.
sbt launchconfig issue
organization := "org.dummy"
name := "dummy"
version := "0.1.0-SNAPSHOT"
scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016"
)
conscript.Harness.conscriptSettings
#!/bin/sh
java -jar "$HOME/.conscript/sbt-launch.jar" "@$HOME/.conscript/dummy/dummy/dummy/launchconfig" "$@"
import java.util.Locale
import javax.servlet.http.{Cookie, HttpServletResponse}
class Dummy extends xsbti.AppMain {
def run(config: xsbti.AppConfiguration) =
try {
// Creating a dummy HttpServletResponse
// - succeeds from sbt run or sbt console
// - fails through launchconfig using the `dummy` script below (NoClassDefFound exception)
val r = new HttpServletResponse {
def sendError(sc: Int, msg: String) = ???
def sendError(sc: Int) = ???
def containsHeader(name: String) = ???
def addHeader(name: String, value: String) = ???
def setStatus(sc: Int) = ???
def setStatus(sc: Int, sm: String) = ???
def getHeaderNames = ???
def addIntHeader(name: String, value: Int) = ???
def encodeURL(url: String) = ???
def addCookie(cookie: Cookie) = ???
def addDateHeader(name: String, date: Long) = ???
def setDateHeader(name: String, date: Long) = ???
def getStatus = ???
def encodeRedirectUrl(url: String) = ???
def getHeaders(name: String) = ???
def sendRedirect(location: String) = ???
def setHeader(name: String, value: String) = ???
def setIntHeader(name: String, value: Int) = ???
def encodeRedirectURL(url: String) = ???
def encodeUrl(url: String) = ???
def getHeader(name: String) = ???
def getLocale = ???
def isCommitted = ???
def setBufferSize(size: Int) = ???
def setContentLength(len: Int) = ???
def setContentType(`type`: String) = ???
def resetBuffer() = ???
def getCharacterEncoding = ???
def setCharacterEncoding(charset: String) = ???
def getOutputStream = ???
def getWriter = ???
def flushBuffer() = ???
def setLocale(loc: Locale) = ???
def getContentType = ???
def reset() = ???
def getBufferSize = ???
}
Console.err println s"$r"
Exit(0)
} catch {
case _: Exception =>
Exit(1)
}
case class Exit(code: Int) extends xsbti.Exit
}
# Should go in $HOME/.conscript/dummy/dummy/dummy/
[app]
version: 0.1.0-SNAPSHOT
org: org.dummy
name: dummy
class: Dummy
[scala]
version: 2.10.4
[repositories]
local
maven-central
sonatype-releases: https://oss.sonatype.org/content/repositories/releases/
sonatype-snapshots: https://oss.sonatype.org/content/repositories/snapshots/
[boot]
directory: /home/alexandre/.conscript/boot
// Should go in project/
addSbtPlugin("net.databinder" % "conscript-plugin" % "0.3.5")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment