Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Kotlin Code on SBT / Play Framework?

I'm a huge fan of the PlayFramework, but I have limited experience with SBT / Scala. I've been trying to use Kotlin more, so I'm trying to get Kotlin Running on SBT / PlayFramework.

I've used Kotlin with the Gradle Build system, but that requires me to apply the Kotlin Gradle plugin. Not sure how to do the equivalent for SBT.

Here is your basic build.sbt for Play. How would I go about getting adding Kotlin?

name := """KotlinTestServer"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  javaWs
)

I'd have to add "org.jetbrains.kotlin" % "kotlin-stdlib" % "0.10.195" as a library dependency, but what else?

like image 932
spierce7 Avatar asked Jan 02 '15 23:01

spierce7


People also ask

How do I run Playframework?

You can run the created application and view the result in the default browser http://localhost:9000. To run a Play application: Create a new Run Configuration – From the main menu, select Run -> Edit Configurations. Click on the + to add a new configuration.

How do I run a debug in play framework?

Generate configuration To debug, start your application with activator -jvm-debug 9999 run and in Eclipse right-click on the project and select Debug As, Debug Configurations. In the Debug Configurations dialog, right-click on Remote Java Application and select New. Change Port to 9999 and click Apply.

What is sbt in play framework?

sbt : The sbt settings that describe building your application. /conf : Configuration files for your application. /project : Further build description information. /public : Where static, public assets for your application are stored. /test : Where your application's test code will be stored.


1 Answers

8 months late, but there is now: Github kotlin-plugin

addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % "0.5")
like image 113
pfn Avatar answered Oct 20 '22 19:10

pfn