Scalatron
I've been recently playing around with writing a bot for Scalatron however I didn't find any great explanation on how to setup a nice development process with SBT. The closest I could find was this blog post but it left a lot to the imagination. I hope you find my annotated Build.sbt below better and more clear!
If you launch sbt and run play
you should see the Scalatron server start up and pickup your Bot!
organization := "com.fzakaria" libraryDependencies ++= { Seq( "ch.qos.logback" % "logback-classic" % "1.1.2", "org.slf4j" % "slf4j-api" % "1.7.7", "org.scalatest" %% "scalatest" % "1.9.2" % "test" ) } val copyBot = TaskKey[Unit]("copyBot", "Copies your bot over!") copyBot <<= (botDirectoryTask, name, (Keys.`package` in Compile)) map { (botDirectory, name, botJar) => IO createDirectory (botDirectory / name) //Scalatron explicitly requires "ScalatronBot.jar" IO copyFile (botJar, botDirectory / name / "ScalatronBot.jar") } val play = TaskKey[Unit]("play", "Runs your scalatron bot!") val botDirectoryTask = SettingKey[File]("bot-directory") botDirectoryTask := file("bots") play <<= (botDirectoryTask,(dependencyClasspath in Compile),(unmanagedClasspath in Compile),(Keys. `package` in Compile) ) map { (botDirectory,dependencyClasspath,unmanagedClasspath, botJar) => val cmd = "java" :: "-cp" :: Seq(Seq(botJar),dependencyClasspath.files,unmanagedClasspath.files). flatten.absString :: "scalatron.main.Main" :: "-plugins" :: botDirectory.absolutePath :: Nil println(cmd) cmd ! } play <<= play.dependsOn(copyBot)