Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scaffolding for Play Framework 2

Is there scaffolding generator utility for Play Framework 2 for Scala like Ruby on Rails has? I found some topics about this but didn't figure out which one was most popular or even if there was the standard one?

Your thoughts?

UPDATE: I mean scaffolding for generating controllers, views, models or any of them.

like image 475
Incerteza Avatar asked Feb 14 '26 17:02

Incerteza


1 Answers

Giter8 will do most of the work for you.

You can either start a new project from scratch with giter8 - https://github.com/playframework/play-scala-seed.g8 - or add the scaffolding plugin directly - https://www.foundweekends.org/giter8/scaffolding.html.

New project

From https://www.playframework.com/documentation/3.0.x/NewApplication :

  • sbt new playframework/play-scala-seed.g8 (add --branch 2.9.x if you want a specific version rather than the latest)

Existing project

From https://www.foundweekends.org/giter8/scaffolding.html :

  • Add the plugin to your project directly with addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "X.XX.X")

Basic usage

Inside an sbt shell, run g8Scaffold <TAB> to view available scaffolds, or g8Scaffold <name of template> if you already have a template in mind which you want to use. If you use the --force option it'll overwrite your existing files - this can be useful, but beware that it'll also potentially overwrite your existing routes file(s).

like image 73
James Whiteley Avatar answered Feb 17 '26 11:02

James Whiteley