Skip to content

Latest commit

 

History

History
134 lines (105 loc) · 3.42 KB

File metadata and controls

134 lines (105 loc) · 3.42 KB

Getting Started

The best way of getting started is using the jooby console. It is a small application that generates Jooby projects very quickly.

Features

  • Maven or Gradle build

  • Java or Kotlin application

  • Script or MVC routes

  • Jetty, Netty or Undertow application

  • Uber/Fat jar or Stork native launcher

  • Dockerfile

To install the console:

  • Download jooby-cli.zip

  • Unzip jooby-cli.zip in your user home directory (or any other directory you prefer to)

  • Find the native launchers in the bin directory

Tip

You might want to add the native launcher bin/jooby or bin/jooby.bat to system path variable. So its globally accessible from any location.

Note

To simplify documentation we use jooby as command. Windows users must use jooby.bat

Setting workspace:
jooby set -w ~/Source

All code will be saved inside the ~/Source directory.

Workspace directory is ready!

Now type jooby hit ENTER.

After prompt type help create:

jooby
jooby> help create
Missing required parameter: <name>
Usage: jooby create [-dgikms] [--server=<server>] <name>
Creates a new application
      <name>              Application name or coordinates (groupId:artifactId:
                            version)
  -d, --docker            Generates a Dockerfile
  -g, --gradle            Generates a Gradle project
  -i                      Start interactive mode
  -k, --kotlin            Generates a Kotlin application
  -m, --mvc               Generates a MVC application
  -s, --stork             Add Stork Maven plugin to build (Maven only)
      --server=<server>   Choose one of the available servers: jetty, netty or
                            undertow
jooby>

The create command generates a Jooby application. Some examples:

Creates a Maven Java project:
jooby> create myapp
Creates a Maven Kotlin project:
jooby> create myapp --kotlin
Creates a Gradle Java project:
jooby> create myapp --gradle
Creates a Gradle Kotlin project:
jooby> create myapp --gradle --kotlin

Maven and Java are the default options but you can easily override those with -g -k or -gk (order doesn’t matter). Along with the build and language the create command adds two test classes: UnitTest and IntegrationTest.

Passing the -m or --mvc generates a MVC application:

Creates a Maven Java Mvc project:
jooby> create myapp --mvc

The --server option, allow you to choose between: (J)etty, (N)etty or (U)ndertow:

Creates a Maven Java Project using Undertow:
jooby> create myapp --server undertow

Maven/Gradle configuration generates an uber/fat jar at package time. Maven builds supports generation of Stork launchers.

Creates a Maven Java Project with stork launchers:
jooby> create myapp --stork

There is a -d or --docker option which generates a Dockerfile

Creates a docker file:
jooby> create myapp --docker

The default package in all these examples is set to app, to get fully control of groupId, package, version, etc…​ Use the interactive mode:

Interactive mode:
jooby> create myapp -i