Ryan Medlin
Ryan Medlin

Reputation: 189

What is the proper play-mini project setup for a proper production deployment

Play mini doesn't work like a play project at all really unless i am missing something. it runs within sbt and you cannot use play commands.

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

So how do you deploy this stuff to production? I've tried one-jar and assembly too and it just doesn't work for me

Ive stried the start-script/stage approach but it cannto seem to find my mainclass:

sbt
>add-start-script-tasks
>stage

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

This is my Build.scala. Ive also tried: mainClass in (Compile, stage, run) and many other combinations

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

Upvotes: 0

Views: 535

Answers (1)

Ryan Medlin
Ryan Medlin

Reputation: 189

my Build.scala was incorrect and i was able to get the assembly command working:

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

Upvotes: 1

Related Questions