Payara Micro Gradle Plugin

Payara Micro has a Gradle plugin which can start and stop Payara Micro Enterprise and create an Uber JAR bundle of the application and Payara Micro Enterprise.

The plugin requires JDK 8 or higher and the latest plugin version is currently 1.0.3

Installation

To use it, simply add the following script to your build.gradle:

plugins {
  id "fish.payara.micro-gradle-plugin" version "1.0.3"
}

Configuration Example:

payaraMicro {
    payaraVersion = '{currentVersion}'
    deployWar = false
    useUberJar = true
    daemon = false
    commandLineOptions = [port: 2468]
    javaCommandLineOptions = [Dtest: 'test123', ea:true]
}

For more information, click here.

Plugin Tasks

microBundle

Aim: This task bundles the attached project’s artifact into an Uber JAR with the specified configurations.

Usage: gradle microBundle

Table 1. Configuration tags
Element Default Notes

javaPath

java

Absolute path to the java executable..

payaraVersion

5.21.0

By default microBundle task fetches payara-micro with version 5.21.0.

microStart

Aim: This task starts Payara Micro with the specified configuration.

Usage: gradle microStart

Table 2. Configuration tags
Element Default Notes

useUberJar

false

Use created uber-jar that resides in target folder. The name of the JAR artifact will be resolved automatically by evaluating its final name, artifact ID and version. This configuration element has the higher precedence compared to payaraMicroAbsolutePath and payaraVersion.

payaraMicroAbsolutePath

none

Absolute path to payara-micro executable.

payaraVersion

5.21.0

By default microStart task fetches Payara Micro with version 5.21.0.

daemon

false

Starts Payara Micro in separate JVM process and continues with the gradle build.

immediateExit

false

If Payara Micro is executed in daemon mode, the executor thread will wait for the ready message before shutting down its process. By setting immediateExit to true you can skip this and instantly interrupt the executor thread.

javaPath

java

Absolute path to the java executable.

deployWar

false

If the attached project is of type WAR, it will automatically be deployed to Payara Micro if deployWar is set to true.

javaCommandLineOptions

none

Defines a list of command line options that will be passed to java executable. Command line options can either be defined as key-value pairs or just as list of values. key-value pairs will be formatted as key=value.

commandLineOptions

none

Defines a list of command line options that will be passed onto Payara Micro.

microStop

Aim: This task stops Payara Micro with the specified configuration. By default this goal tries to find out currently executing Payara Micro instance based on project GAV. If processId is defined, it will take precedence and the given processId will immediately kill the executing Payara Micro instance.

Usage: gradle microStop

Table 3. Configuration tags
Element Default Notes

processId

none

Process id of the running Payara Micro instance.

useUberJar

false

Use created uber-jar that resides in build\libs folder. The name of the jar artifact will be resolved automatically by evaluating its final name.