gradle plugin

gradle plugin

Collection of Gradle plugins for Jooby applications.

joobyRun

Run, debug and reload applications.

usage


buildscript {

  repositories {
    mavenCentral()
  }

  dependencies {
    /**
     * joobyRun 
     */
    classpath group: 'org.jooby', name: 'jooby-gradle-plugin', version: '1.6.6'
  }
}

apply plugin: 'jooby'

}
gradle joobyRun

Prints something similar to:

>>> jooby:run[info|main]: Hotswap available on: /my-app
>>> jooby:run[info|main]:   includes: [**/*.class,**/*.conf,**/*.properties,*.js, src/*.js]
>>> jooby:run[info|main]:   excludes: []
INFO  [2015-03-31 17:47:33,000] [dev@netty]: App server started in 401ms

  GET /assets/**           [*/*]     [*/*]    (anonymous)
  GET /                    [*/*]     [*/*]    (anonymous)

listening on:
  http://localhost:8080/

hot reload

The joobyRun tool restart the application every time a change is detected on:

  • classes (*.class)
  • config files (*.conf and *.properties)

Changes on templates and/or static files (*.html, *.js, *.css) wont restart the application, because they are not compiled or cached while running on application.env = dev.

It’s worth to mention that dynamic reload of classes is done via JBoss Modules.

options

joobyRun {
  mainClassName = 'com.mycompany.App'
  compiler = 'on'
  includes = ['**/*.class', '**/*.conf', '**/*.properties']
  excludes = []
  logLevel = 'info'
}

mainClassName

A Gradle property that contains the fully qualified name of the main class. Required.

compiler

The compiler is on by default, unless:

  • A .classpath file is present in the project directory. If present, means you’re a Eclipse user and we turn off the compiler and let Eclipse recompiles the code on save.

  • The compiler is set to off.

On compilation success, the application is effectively reloaded.

On compilation error, the application won’t reload.

Compilation success or error messages are displayed in the console (not at the browser).

includes / excludes

List of file patterns to listen for file changes.

joobyAssets

This is a Gradle task for the asset module. The asset module validate, concatenate, minify or compress JavaScript and CSS assets.

usage

buildscript {

  repositories {
    mavenCentral()
  }

  dependencies {
    /**
     * jooby:run 
     */
    classpath group: 'org.jooby', name: 'jooby-gradle-plugin', version: '1.0.0.CR7'
  }
}

apply plugin: 'jooby'

}
gradle joobyAssets

options

joobyAssets {
  maxAge = '365d'
}

maxAge

Specify the max age cache header, default is: 365d``

joobySpec

This is a Gradle task for the route spec module. The route spec module allows you to export your API/microservices outside a Jooby application.

usage

buildscript {

  repositories {
    mavenCentral()
  }

  dependencies {
    /**
     * jooby:run 
     */
    classpath group: 'org.jooby', name: 'jooby-gradle-plugin', version: '1.0.0.CR7'
  }
}

apply plugin: 'jooby'

gradle joobySpec

This task has no options, the .spec file can found at the build/classes/main