Scaffolding plugin 

Giter8 supplies an sbt plugin for creating and using scaffolds.

Using the scaffold plugin 

Add the following lines in project/scaffold.sbt

addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.16.2")

Once done, the g8Scaffold command can be used in the sbt shell. Use TAB completion to discover available templates.

> g8Scaffold <TAB>
controller   global       model

To overwrite existing files pass the --force flag after the template:

> g8Scaffold model --force

The template plugin will prompt each property that needed to complete the scaffolding process:

> g8Scaffold controller
className [Application]:

Creating a scaffold 

The g8 runtime looks for scaffolds in the src/main/scaffolds in the given GitHub project. Each directory inside src/main/scaffolds is a different scaffold, and will be accessible in the sbt shell using the directory name. Scaffold directories may have a file to define field values, just like ordinary templates. name is again a special field name: if it exists, the scaffold will be generated into a directory based on name, with subdirectories following the layout of the source scaffold directory.

Once a template as been used, scaffolds are stored into <project_root>/.g8

$ ls sample/.g8
total 0
drwxr-xr-x   5 jtournay  staff   170B Aug  6 03:21 .
drwxr-xr-x  11 jtournay  staff   374B Aug  6 05:29 ..
drwxr-xr-x   4 jtournay  staff   136B Aug  6 03:21 controller
drwxr-xr-x   4 jtournay  staff   136B Aug  6 03:21 global
drwxr-xr-x   4 jtournay  staff   136B Aug  6 03:21 model

It’s also possible to create your own scaffold in any sbt project by creating the .g8 directory.