Excelsior JET Gradle Plugin

The Excelsior JET Gradle Plugin enables you to add support for native builds to your existing Gradle projects with ease. It is being developed as an open source project hosted on GitHub, and is available on Maven Central.

The current version supports four types of applications:

  • Plain Java SE applications, defined as applications that (a) can be run with all dependencies explicitly listed on the command-line of the conventional java launcher: java [-cp dependencies-list] main-class and (b) load classes mostly from the listed jars.
  • Tomcat Web applications.war files that can be deployed to the Apache Tomcat application server.
  • Invocation dynamic libraries (e.g. Windows DLLs) callable from non-JVM languages
  • Java applications disguised as Windows services using the Excelsior JET WinService API

Assuming that a copy of Excelsior JET is accessible via the operating system PATH, all you need to use it in a project is:

  1. Add the plugin dependency in the buildscript{} configuration of the build.gradle file:

    buildscript {
        ext.jetPluginVersion = '1.0.0'
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath "com.excelsiorjet:excelsior-jet-gradle-plugin:$jetPluginVersion"
        }
    }
  2. Apply and configure the excelsiorJet plugin as follows:

    apply plugin: 'excelsiorJet'
    excelsiorJet {
        mainClass = ''
    }
  3. Set the mainClass parameter and use the following command line to build the application:

    gradlew jetBuild
  1. Add the plugin dependency in the buildscript{} configuration of the build.gradle file:

    buildscript {
        ext.jetPluginVersion = '1.0.0'
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath "com.excelsiorjet:excelsior-jet-gradle-plugin:$jetPluginVersion"
        }
    }
  2. Apply and configure the excelsiorJet plugin as follows:

    apply plugin: 'excelsiorJet'
    excelsiorJet {
        tomcat {
            tomcatHome ""
        }
    }
  3. Set the tomcatHome parameter to point to the master Tomcat installation — basically, a clean Tomcat instance that was never launched, and use the following command line to build the application:

    gradlew jetBuild
  1. Add the plugin dependency in the buildscript{} configuration of the build.gradle file:

    buildscript {
        ext.jetPluginVersion = '1.0.0'
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath "com.excelsiorjet:excelsior-jet-gradle-plugin:$jetPluginVersion"
        }
    }
  2. Apply and configure the excelsiorJet plugin as follows:

    apply plugin: 'excelsiorJet'
    excelsiorJet {
        appType = "dynamic-library"
    }
  3. Use the following command line to build the library:

    gradlew jetBuild

Warning Testing and using dynamic libraries that expose Java APIs is tricky. Make sure to read the respective section of the plugin documentation.

  1. Add the Excelsior JET WinService API as a dependency to your Gradle build script:

    dependencies {
        compileOnly "com.excelsiorjet:excelsior-jet-winservice-api:1.0.0"
    }
  2. Implement a subclass of com.excelsior.service.WinService as described in the Excelsior JET WinService API documentation.

  3. Add the plugin dependency in the buildscript{} configuration of the build.gradle file:

    buildscript {
        ext.jetPluginVersion = '1.0.0'
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath "com.excelsiorjet:excelsior-jet-gradle-plugin:$jetPluginVersion"
        }
    }
  4. Apply and configure the plugin as follows:

    apply plugin: 'excelsiorJet'
    excelsiorJet {
        appType = "windows-service"
        mainClass = "service-main" // <--- Your WinService implementation
        windowsService{
            name = ""
            displayName = ""
            description = ""
            arguments  = []
            logOnType = ""
            allowDesktopInteraction = false
            startupType = ""
            startServiceAfterInstall = true
            dependencies = []
        }
    }

    where service-main is the name of the class that you implemented on the previous step. For descriptions of all other parameters, refer to plugin documentation.

  5. Use the following command line to build the service:

    gradlew jetBuild

For more information about Windows services support in Excelsior JET, refer to to the "Windows Services" Chapter of the Excelsior JET for Windows User's Guide.


Notice The Excelsior JET Gradle plugin requires the Java plugin be applied beforehand: apply plugin: 'java'

Refer to plugin documentation for further instructions.