Skip to content

Latest commit

 

History

History
32 lines (18 loc) · 1.29 KB

README.adoc

File metadata and controls

32 lines (18 loc) · 1.29 KB

Creating Ratpack projects with Lazybones and running them with Gradle and as standalone JAR (10 minutes)

Lazybones is a scaffolding tool to generate application skeletons for different projects, and it’s the recommended option for bootstrapping a Ratpack application.

Let’s create a Ratpack project in the current directory:

lazybones create ratpack .

After that, you can run the application with Gradle:

./gradlew run

Examining the project layout (5 minutes)

Once you have created the app, let’s have a look at it’s content:

  • build.gradle is the main Gradle build file.

  • src/main/groovy is the package root for your Groovy classes (as in all Gradle/Maven applications).

  • src/ratpack contains Ratpack specific artifacts. The most important one is Ratpack.groovy which contains the Ratpack DSL. If you take a look at it, you will find it similar to the script we created in the previous exercise.

  • src/test/groovy will contain your Spock tests.

Generating a standalone fat JAR (5 minutes)

The build.gradle file generated by Lazybones comes with the Shadow plugin preinstalled, which will allow you to generate a standalone fat JAR.

To do so:

./gradlew shadowJar

Then, you can run it by simply executing:

java -jar build/libs/*-all.jar