Simple example which shows how to use skinny-task without web application project settings
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Simple example which shows how to use skinny-task

This is a simple example which shows how to use only skinny-task without web application project settings. Since skinny-task's task runner works as a main class, sbt run detects and invokes this class. Yes, build tool independent and easy to customize! That's pretty good.

skinny-task has the following out-of-the-box generators:

Especially reverse-xxx generators will help you a lot when bootstrapping new application which works with existing database tables.

Seeing is believing. Let's get started with skinny's useful generators.

Project Structure

The project structure is completely simple. The Flyway things under src/main/resources/db are just needed for the purpose of demonstration. If you work with existing databases, you don't need any migration things. So only build.sbt, application.conf and TaskRunner.scala are essentially required.

$ tree
├── build.sbt // very simple sbt settings
├── project
│   └── // specify sbt version
└── src
    └── main
        ├── resources
        │   ├── application.conf // settings for database connection
        │   ├── db
        │   │   └── migration
        │   │       └── V0__example.sql // flywaydb style migration file, just for demo
        │   └── logback.xml // settings for logging
        └── scala
            └── TaskRunner.scala // task runner as a main class

Task Runner

We believe you'll immediately undestand how to define tasks.

The simplest task definition is as below. If you'd like to customize some configurations, instantiate with overriding methods as the above example.

register("generate:reverse-model-all", (params) => 

How to run this example

brew install sbt
sbt "run db:migrate"
sbt "run generate:reverse-model-all"

You will see the following output


See this branch:

Reference Links