什么是适当的play-mini项目设置适合生产部署

时间:2012-11-21 16:24:49

标签: scala playframework sbt

除非我遗漏了某些东西,否则Play mini根本不像游戏项目那样工作。它在sbt内运行,你不能使用播放命令。

https://github.com/typesafehub/play2-mini

那么如何将这些东西部署到生产中?我也试过了一个罐子和装配,它对我来说不起作用

我支持开始脚本/阶段方法,但它似乎找不到我的主类:

sbt
>add-start-script-tasks
>stage

[info] Wrote start script for mainClass := None to /Users/rmedlin/rtbv2/target/start

这是我的Build.scala。我也尝试过:mainClass in(Compile,stage,run)和许多其他组合

object Build extends Build {
  override lazy val settings = super.settings
  lazy val root = Project(id = "rtbv2", 
base = file("."), settings = Project.defaultSettings).settings(
  resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/",
  resolvers += "Typesafe Snapshot Repo" at "http://repo.typesafe.com/typesafe/snapshots/",
  libraryDependencies += "com.typesafe" %% "play-mini" % "2.0.1",
  mainClass in (Compile, run) := Some("play.core.server.NettyServer"))
}

1 个答案:

答案 0 :(得分:1)

我的Build.scala不正确,我能够使汇编命令正常工作:

trait ConfigureScalaBuild {


lazy val typesafe = "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

lazy val typesafeSnapshot = "Typesafe Snapshots Repository" at "http://repo.typesafe.com/typesafe/snapshots/"

val netty = Some("play.core.server.NettyServer")

def scalaMiniProject(org: String, name: String, buildVersion: String, baseFile:         java.io.File = file(".")) = Project(id = name, base = baseFile, settings =      Project.defaultSettings ++ assemblySettings).settings(
 version := buildVersion,
 organization := org,
 resolvers += typesafe,
 resolvers += typesafeSnapshot,
 logManager <<= extraLoggers(com.typesafe.util.Sbt.logger),
 libraryDependencies += "com.typesafe" %% "play-mini" % "2.0.1",
 mainClass in (Compile, run) := netty,
 mainClass in assembly := netty,
 ivyXML := <dependencies> <exclude org="org.springframework"/> </dependencies>
)
}