Question

I have two related questions here.

In Play 2.2.x, the distribution was bundled as a zip file, and available for download through the maven repository http://downloads.typesafe.com/play/2.2.x/play-2.2.x.zip. This meant that you could use a pom.xml and embed play into your app without needing to use sbt. Given 2.3.x has shifted to the activator model, is it still possible to use it with maven?

And secondly, is it possible to use play 2.3.x without activator at all? (I know they have a sbt plugin for play, but that seems very complex as well).

Thanks!

Was it helpful?

Solution

Activator is only needed to create the empty template project, which you could also do by hand if you know a bit about play. After that empty project is created all you need is sbt (which actually is a pretty central part of activator).

With play 2.3 the distribution model changed from the one big zip-file to regular ivy/maven dependencies, so you could possibly get all dependencies right from a maven project. The problem is that the sbt play setup does so much more: template compilation, routes DSL compilation, hot reloading, asset pipeline stuff, so I don't think maven actually is an option.

OTHER TIPS

Yes.

Example on Github

package io.github.alancnet

import java.io.File

import play.api.{Environment, ApplicationLoader}

object PlayTest {
  class Dummy{}
  def main(args:Array[String]):Unit = {
    def startWebServer = {
      val environment = new Environment(
        new File("."),
        classOf[Dummy].getClassLoader,
        play.api.Mode.Dev
      )
      val context = play.api.ApplicationLoader.createContext(environment)
      val application = ApplicationLoader(context).load(context)

      play.api.Play.start(application)

      play.core.server.NettyServer.fromApplication(
        application
      )
    }

    startWebServer

  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top