How to use Play Framework without using typesafe activator

Play Framework with sbt

Normally, I think that the activator is used to do the Play Framework. However, I would like to use sbt to write the settings myself.

environment

** I get an error with Scala 2.10. This time I will use 2.11.8. ** **

sbt settings

I will write with reference to this page. Play Framework 2 tutorial without Activator

sbt.version=0.13.15
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.15")
name := "my-first-app-without-activator"
version := "1.0"
scalaVersion := "2.11.8"
lazy val root = (project in file(".")).enablePlugins(PlayJava)

Since we will use it in Java this time, set enablePlugins to PlayJava. When using with Scala, replace it with PlayScala.

Application.java


package controllers;

import play.mvc.Controller;
import play.mvc.Result;

public class Application extends Controller {

    public Result index() {
        return ok("hello");
    }

}
GET	/	controllers.Application.index()

It seems that it should be made for the time being.

$ touch conf/application.conf

The contents are empty.

Try to move

$ sbt run

If the following is displayed, it is OK.

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

Access (http: // localhost: 9000) and you should see "hello".

Recommended Posts

How to use Play Framework without using typesafe activator
How to use BootStrap with Play Framework
How to install Play Framework 2.6 for Mac
How to play audio and music using javascript
How to use Java framework with AWS Lambda! ??
How to use Map
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use map
How to use collection_select
How to use Twitter4J
How to use active_hash! !!
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
[How to use label]
How to use identity
How to use hashes
How to use JUnit 5
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
How to play MIDI files using the Java Sound API (specify the MIDI device to use)
How to use Struts2 * Spring Framework (Spring plugin) June 2017 Version
How to start tomcat local server without using eclipse
[Java] How to use Map
How to use Chain API
[Java] How to use Map
How to use Priority Queuing
[Rails] How to use enum
How to use java Optional
How to use JUnit (beginner)
How to use @Builder (Lombok)
[Swift] How to use UserDefaults
How to use java class
How to use Swift UIScrollView
How to use Big Decimal
[Java] How to use Optional ②
[Java] How to use removeAll ()
How to use String [] args
[Java] How to use string.format
How to use rails join
How to use Java Map
Ruby: How to use cookies
How to use dependent :: destroy
How to use Eclipse Debug_Shell
Introduced Dozer to Play Framework
How to use Apache POI
[Rails] How to use validation
How to use Java variables
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
How to use GC Viewer
[Java] How to use Optional ①
How to use Lombok now
[Creating] How to use JUnit