【问题标题】:What is the proper play-mini project setup for a proper production deployment什么是正确的生产部署的正确 play-mini 项目设置
【发布时间】:2012-11-28 07:29:15
【问题描述】:

Play mini 根本不像一个游戏项目,除非我错过了什么。它在 sbt 中运行,你不能使用播放命令。

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

那么如何将这些东西部署到生产环境中呢?我也尝试过 one-jar 和组装,但它对我不起作用

我尝试了 start-script/stage 方法,但它似乎无法找到我的主类:

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"))
}

【问题讨论】:

  • 可惜我没用play-mini,不过如果你只需要一个REST接口,你应该看看Spray

标签: scala playframework sbt


【解决方案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>
)
}

【讨论】:

    猜你喜欢
    • 2019-05-25
    • 1970-01-01
    • 2018-12-05
    • 1970-01-01
    • 2016-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多