Skip to content

hanggrian/packaging-gradle-plugin

Repository files navigation

CircleCI Plugin Portal Java

Packaging Gradle Plugin

Gradle plugin that wraps JARs into native bundle for Windows, macOS, and Linux.

  • Complete customization for each distribution.
  • Pack multiple distributions with a single task.

Download

Using plugins DSL:

plugins {
    id('com.hanggrian.packaging') version "$version"
}

Using legacy plugin application:

buildscript {
    repositories {
        gradlePluginPortal()
    }
    dependencies {
        classpath("com.hanggrian:packaging-gradle-plugin:$version")
    }
}

apply plugin: 'com.hanggrian.packaging'

Usage

Below are example configuration for Windows64 and MacOS distributions. Note that properties of distribution configuration may override extension configuration.

packaging {
    appName.set('Custom Directory')
    mainClass.set('com.example.App')
    modules = ['javafx.controls', 'javafx.graphics']
    modulePaths.add(new File('/path/to/javafx-sdk/lib'))
    verbose.set(true)
}

For easier setup, also use application plugin to distribute classpath with installDist command.

apply plugin: 'application'
apply plugin: 'com.hanggrian.packaging'

application {
    applicationName = 'My App'
    mainClass.set('com.example.App')
}