📦 Start making native distributions for your JAR
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
buildSrc
demo
gradle/wrapper
packr-gradle-plugin
website
.gitignore
.travis.yml
LICENSE
README.md
build.gradle.kts
gradlew
gradlew.bat
settings.gradle.kts

README.md

Packr Plugin

bintray download build license

Gradle plugin of packr, a library that wraps JARs into native bundle for Windows, macOS, and Linux.

Download

Add plugin to buildscript:

buildscript {
    repositories {
        jcenter()
        maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
    dependencies {
        classpath "com.hendraanggrian.packr:packr-gradle-plugin:$version"
    }
}

Usage

Apply plugin in your module.

apply plugin: 'com.hendraanggrian.packr'

Configure packr task, below are available configurations.

packr {
    executable 'example'
    classpath 'my.jar', 'path/to/other.jar'
    mainClass 'com.example.App'
    vmArgs 'Xmx1G'
    resources 'image.jpg', 'path/to/other.jpg'
    minimizeJre 'hard'
    outputDirectory 'my/folder'   
    verbose true
    openOnDone true
    
    macOS {
        it.name 'Example.app'
        it.jdk 'path/to/mac_jdk'
        it.icon 'path/to/mac_icon.icns'
        it.bundleId 'com.example.app'
        it.vmArgs '-Xmx512M'
    }
    windows32 {
        it.name 'Example Windows 32-bit'
        it.jdk 'path/to/windows_32_jdk'
        it.vmArgs '-Xmx256M'
    }
    windows64 {
        it.name 'Example Windows 64-bit'
        it.jdk 'path/to/windows_64_jdk'
        it.vmArgs '-Xmx512M'
    }
    linux32 {
        it.name 'Example Windows 32-bit'
        it.jdk 'path/to/windows_32_jdk'
        it.vmArgs '-Xmx256M'
    }
    linux64 {
        it.name 'Example Linux 64-bit'
        it.jdk 'path/to/linux_64_jdk'
        it.vmArgs '-Xmx512M'
    }
}

Packr will then register task to each distribution (e.g.: packMacOS, packWindows32, etc.). Each of those task will only take effect if related distribution is configured.

Default configuration

packr {
    executable = project.name
    classpath = []
    resources = []
    minimizeJre = PackrExtension.MINIMIZE_SOFT
    outputDirectory = 'build/releases'
    vmArgs = []
    verbose = false
    openOnDone = false
}

License

Copyright 2018 Hendra Anggrian

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.