Skip to content
forked from mini2Dx/parcl

Gradle plugin for bundling your Java application for distribution on Windows, Mac and Linux

License

Notifications You must be signed in to change notification settings

CreamyCookie/parcl

 
 

Repository files navigation

parcl

Build Status

Gradle plugin for bundling your Java application as Windows, Mac and Linux native applications

How to use

Add the following buildscript configuration to the top of your build.gradle

buildscript {
    repositories {
        mavenLocal()
        maven { url "https://mini2dx.org/maven/content/repositories/thirdparty" }
		maven { url "https://mini2dx.org/maven/content/repositories/releases" }
        mavenCentral()
    }
    dependencies {
        classpath group: 'org.mini2Dx', name: 'parcl', version: '1.0.7'
    }
}

Then add the plugin to your project, configuration for your main class and how you want parcl to bundle the application. The following shows the minimum required configuration.

project(":projectName") {
   apply plugin: "java"
   apply plugin: "application"
   apply plugin: "org.mini2Dx.parcl"
   
   ........

   mainClassName = "com.example.MyMainClass"

   parcl {
      exe {
         exeName = "myapplication"
      }
		
      app {
         appName = "My Application"
         icon = "relative/path/to/icon.icns"
         applicationCategory = "public.app-category.adventure-games"
         displayName = 'My Application'
         identifier = 'com.example.my.apple.identifier'
         copyright = 'Copyright 2015 Your Name Here'
      }
		
      linux {
         binName = "myapplication"
      }
   }
}

The plugin will add a task called 'bundleNative' to your project. This must be invoked on the platform you wish to bundle the application for, i.e. You must be on Mac OS X to bundle a Mac application

gradle clean build bundleNative

Depending on your platform, the resulting application bundle will appear in build/windows, build/mac or build/linux.

Advanced Configuration

There are several optional configuration parameters for each platform.

Optional Parameter Description Example
vmArgs Passes JVM options to the application on launch vmArgs = ["-Xmx1g"]
appArgs Passes application arguments to the application on launch appArgs = ["arg1", "arg2"]
withJre Copies your local JRE and bundles it with the application. The value of $JAVA_HOME must be passed as an argument. withJre("/usr/lib/jvm/java-8-oracle/")

The following example shows all options in use.

mainClassName = "com.example.MyMainClass"

parcl {
  exe {
    vmArgs = ["-Xmx1g"]
    appArgs = ["arg1", "arg2"]
    exeName = "myapplication"
			
    withJre("C:\\Program Files (x86)\\Java\\jdk1.8.0_25\\jre")
  }
		
  app {
    vmArgs = ["-Xmx1g"]
    appArgs = ["arg1", "arg2"]
    appName = "My Application"
    icon = "relative/path/to/icon.icns"
    applicationCategory = "public.app-category.adventure-games"
    displayName = 'My Application'
    identifier = 'com.example.my.apple.identifier'
    copyright = 'Copyright 2015 Your Name Here'

    withJre("/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home")
  }
		
  linux {
    vmArgs = ["-Xmx1g"]
    appArgs = ["arg1", "arg2"]
    binName = "myapplication"
			
    withJre("/usr/lib/jvm/java-8-oracle/")
  }
}

Contributing

Pull requests are welcome :) Any issues found please add them to the Issue Tracker.

Gradle wrapper is included in the code. The following tools were used for development:

  • Gradle 2.2.1
  • Groovy 2.3.6
  • Visual Studio 2010

If you are releasing a version of parcl, it must be built on Windows so that parcl.exe is compiled and included in the jar.

About

Gradle plugin for bundling your Java application for distribution on Windows, Mac and Linux

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 67.7%
  • C# 20.4%
  • Java 10.1%
  • Shell 1.8%