这听起来很基本,但实际上花了我一整天的时间:我想改变以改变在开发中运行 scalatra 的端口。我从 hello world g8 模板开始,并从那里开始构建。
这是我到目前为止所尝试的:
更改 build.scala 中的端口,ala 文档: http ://www.scalatra.org/guides/deployment/configuration.html 这不会编译,因为端口未定义。
更改 build.scala 中的端口,这两个示例:https:gist.github.com dozed 58af6cfbfe721a562a48 https://github.com/JamesEarlDouglas/xsbt-web-plugin/blob/master/src/sbt-test/web/ servlet/project/Build.scala 同样的问题:端口未定义
重新定义入口点,ala http: www.scalatra.org guides deployment Standalone.html 仍然在端口 8080 上运行
在引导程序中更改 init 参数,ala http: www.scalatra.org guides deployment configuration.html 仍然在端口 8080 上运行
任何帮助表示赞赏。由于某种原因,我不能发布超过 2 个链接,所以用正斜杠替换空格以跟随 url。
这是我的 build.scala 以防万一。
import sbt._
import Keys._
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import com.mojolly.scalate.ScalatePlugin._
import ScalateKeys._
import com.earldouglas.xsbtwebplugin._
import WebPlugin._
object YesManBuild extends Build {
val Organization = "com.prezi"
val Name = "Yes Man"
val Version = "0.1.0-SNAPSHOT"
val ScalaVersion = "2.10.2"
val ScalatraVersion = "2.2.1"
//def Conf = config("container")
lazy val project = Project (
"yes-man",
file("."),
settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ scalateSettings ++ Seq(
//port in Conf := 8081,
mainClass := Some("com.prezi.eureka.JettyLauncher.main"),
organization := Organization,
name := Name,
version := Version,
scalaVersion := ScalaVersion,
resolvers += Classpaths.typesafeReleases,
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-log4j12" % "1.7.5",
"com.netflix.eureka" % "eureka-client" % "1.1.97",
"com.netflix.ribbon" % "ribbon-httpclient" % "0.1.10",
"com.netflix.ribbon" % "ribbon-eureka" % "0.1.11",
"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" % "container",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar")),
"org.eclipse.jetty.aggregate" % "jetty-all" % "9.0.4.v20130625"
),
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")
)
)
}
)
)
}
多谢你们,
〜埃里克