All Projects → TheBoegl → Gradle Launch4j

TheBoegl / Gradle Launch4j

Licence: apache-2.0
A gradle-plugin to create windows executables with launch4j

Programming Languages

groovy
2714 projects

Projects that are alternatives of or similar to Gradle Launch4j

Reckon
Infer a project's version from your Git repository.
Stars: ✭ 124 (-29.94%)
Mutual labels:  gradle, gradle-plugin
Gradle Eclipse Aar Plugin
Gradle plugin to use Android AAR libraries on Eclipse.
Stars: ✭ 127 (-28.25%)
Mutual labels:  gradle, gradle-plugin
Jib
🏗 Build container images for your Java applications.
Stars: ✭ 11,370 (+6323.73%)
Mutual labels:  gradle, gradle-plugin
Godot
Keep track of how much time you spend on Gradle builds
Stars: ✭ 113 (-36.16%)
Mutual labels:  gradle, gradle-plugin
Gradle Pitest Plugin
Gradle plugin for PIT Mutation Testing
Stars: ✭ 144 (-18.64%)
Mutual labels:  gradle, gradle-plugin
Okbuck
OkBuck is a gradle plugin that lets developers utilize the Buck build system on a gradle project.
Stars: ✭ 1,513 (+754.8%)
Mutual labels:  gradle, gradle-plugin
Versioning
Gradle plug-in to generate version information from the SCM branch (Git or Svn)
Stars: ✭ 157 (-11.3%)
Mutual labels:  gradle, gradle-plugin
Kordamp Gradle Plugins
A collection of Gradle plugins
Stars: ✭ 100 (-43.5%)
Mutual labels:  gradle, gradle-plugin
Kotlin Gradle Plugin Template
🐘 A template to let you started with custom Gradle Plugins + Kotlin in a few seconds
Stars: ✭ 141 (-20.34%)
Mutual labels:  gradle, gradle-plugin
Gson Plugin
辅助 Gson 库的 gradle 插件,防止 Json 数据解析类型异常。
Stars: ✭ 133 (-24.86%)
Mutual labels:  gradle, gradle-plugin
Gradle Build Properties Plugin
Keep your secrets secret. External build properties support for your Gradle scripts.
Stars: ✭ 110 (-37.85%)
Mutual labels:  gradle, gradle-plugin
Gradle Android Plugin
[Deprecated] Gradle Android Plugin 中文版使用手册,如有纰漏,望斧正
Stars: ✭ 155 (-12.43%)
Mutual labels:  gradle, gradle-plugin
Jenkins Pipeline Shared Libraries Gradle Plugin
Gradle plugin to help with build and test of Jenkins Pipeline Shared Libraries (see https://jenkins.io/doc/book/pipeline/shared-libraries/)
Stars: ✭ 103 (-41.81%)
Mutual labels:  gradle, gradle-plugin
Clojurephant
Clojure and Clojurescript support for Gradle
Stars: ✭ 118 (-33.33%)
Mutual labels:  gradle, gradle-plugin
Gradle Changelog Plugin
Plugin for parsing and managing the Changelog in a "keep a changelog" style.
Stars: ✭ 102 (-42.37%)
Mutual labels:  gradle, gradle-plugin
Bytex
ByteX is a bytecode plugin platform based on Android Gradle Transform API and ASM. 字节码插件开发平台
Stars: ✭ 2,140 (+1109.04%)
Mutual labels:  gradle, gradle-plugin
Gradle Quality Plugin
Gradle quality plugin for Java and Groovy
Stars: ✭ 97 (-45.2%)
Mutual labels:  gradle, gradle-plugin
Vertx Gradle Plugin
An opinionated Gradle plugin for Vert.x projects
Stars: ✭ 98 (-44.63%)
Mutual labels:  gradle, gradle-plugin
Forma
Meta build system with Android and Gradle support.
Stars: ✭ 127 (-28.25%)
Mutual labels:  gradle, gradle-plugin
Gradle Aem Plugin
Swiss army knife for Adobe Experience Manager related automation. Environment setup & incremental AEM application build which takes seconds, not minutes.
Stars: ✭ 145 (-18.08%)
Mutual labels:  gradle, gradle-plugin

Get automatic notifications about new "gradle-launch4j" versions Download

Build status: Build status master Build status develop

Table of contents

Introduction

The gradle-launch4j plugin uses launch4j 3.12 to create windows .exe files for java applications. This plugin is compatible with the Gradle versions 2 and later.

Tasks

There are 3 tasks:

  • createExe - Backward compatible task to generate an .exe file. Execute this task to generate an executable. With default settings this creates the executable under ${project.buildDir}/launch4j and puts all runtime libraries into the lib subfolder.
  • createAllExecutables - Helper task to run all tasks of the Launch4jExternalTask and Launch4jLibraryTask type.
  • launch4j - Deprecated placeholder task that depends on the above. This task was deprecated in favor of the createExe task and to avoid the name conflict of launch4j on the project.

Launch4j no longer needs to be installed separately, but if you want, you can still use it from the PATH. Since version 2.0 use the Launch4jExternalTask to create your executable.

Configuration

The configuration follows the structure of the launch4j xml file. The gradle-launch4j plugin tries to pick sensible defaults based on the project. The only required value is the mainClassName.

How to include

An example configuration within your build.gradle for use in all Gradle versions might look like:

plugins {
  id 'java'
  id 'edu.sc.seis.launch4j' version '2.4.9'
}

launch4j {
  mainClassName = 'com.example.myapp.Start'
  icon = "${projectDir}/icons/myApp.ico"
}

The same script snippet for using legacy plugin application:

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath 'edu.sc.seis.gradle:launch4j:2.4.9'
  }
}

repositories {
  jcenter()
}

apply plugin: 'java'
apply plugin: 'edu.sc.seis.launch4j'

launch4j {
  mainClassName = 'com.example.myapp.Start'
  icon = "${projectDir}/icons/myApp.ico"
}

If no repository is configured before applying this plugin the Maven central repository will be added to the project.

See the Gradle User guide for more information on how to use a custom plugin and the plugin page for the above settings.

How to configure

The values configurable within the launch4j extension along with their defaults are:

Property Name Default Value Comment
String outputDir "launch4j" This is the plugin's working path relative to $buildDir. Use the distribution plugin or a custom implementation to copy necessary files to an output location instead of adjusting this property.
String libraryDir "lib"
Object copyConfigurable null User-redefined set of files to be copied into libraryDir (if not set the default logic of copying will be executed)
Set<String> classpath [] User-redefined classpath property (if not set the default logic based on the set of copied to libraryDir files will be used)
String xmlFileName "launch4j.xml"
String mainClassName
boolean dontWrapJar false
String headerType "gui"
String jar "lib/"+project.tasks[jar].archiveName or
"", if the JavaPlugin is not loaded
String outfile project.name+'.exe'
String errTitle ""
String cmdLine ""
String chdir '.'
String priority 'normal'
String downloadUrl "http://java.com/download"
String supportUrl ""
boolean stayAlive false
boolean restartOnCrash false
String manifest ""
String icon "" A relative path from the outfile or an absolute path to the icon file. If you are uncertain use "${projectDir}/path/to/icon.ico"
String version project.version
String textVersion project.version
String copyright "unknown"
String companyName ""
String description project.name deprecated use fileDescription instead
String fileDescription project.name
String productName project.name
String internalName project.name
String trademarks
String language "ENGLISH_US"
String opt "" deprecated use jvmOptions instead
Set<String> jvmOptions [ ]
String bundledJrePath
boolean bundledJre64Bit false
boolean bundledJreAsFallback false
String jreMinVersion project.targetCompatibility or
the current java version,
if the property is not set
String jreMaxVersion
String jdkPreference "preferJre"
String jreRuntimeBits "64/32"
Set<String> variables [ ]
String mutexName
String windowTitle
String messagesStartupError
String messagesBundledJreError
String messagesJreVersionError
String messagesLauncherError
String messagesInstanceAlreadyExists
Integer initialHeapSize
Integer initialHeapPercent
Integer maxHeapSize
Integer maxHeapPercent
String splashFileName A relative path from the outfile or an absolute path to the bmp splash file.
boolean splashWaitForWindows true
Integer splashTimeout 60
boolean splashTimeoutError true
Removed properties Default Value Description
String launch4jCmd "launch4j" use the Launch4jExternalTask instead
boolean externalLaunch4j false use the Launch4jExternalTask instead

Configurable input configuration

In order to configure the input of the copyL4jLib task set the copyConfigurable property. The following example shows how to use this plugin hand in hand with the shadow plugin:

launch4j {
    outfile = 'TestMain.exe'
    mainClassName = project.mainClassName
    copyConfigurable = []
    jar = "lib/${project.tasks.shadowJar.archiveName}"
}

If you use the outdated fatJar plugin the following configuration correctly wires the execution graph:

fatJar {
    classifier 'fat'
    with jar
    manifest {
        attributes 'Main-Class': project.mainClassName
    }
}

fatJarPrepareFiles.dependsOn jar

launch4j {
    outfile = 'TestMain.exe'
    mainClassName = project.mainClassName
    copyConfigurable = []
    jar = "lib/${project.tasks.fatJar.archiveName}"
}

Launch4jLibraryTask

This task type can be used to build multiple executables with Launch4j. The default launch4j configuration from how to configure is used for the default values but can be adjusted. To avoid replacing the resulting xml file or executable on each invocation, xmlFileName and outfile are set to the task name (name.xml and name.exe respectively).

Creating three executables is as easy as:

launch4j {
    outfile = 'MyApp.exe'
    mainClassName = 'com.example.myapp.Start'
    icon = "${projectDir}/icons/myApp.ico"
    productName = 'My App'
}

task createFastStart(type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
    outfile = 'FastMyApp.exe'
    mainClassName = 'om.example.myapp.FastStart'
    icon = "${projectDir}/icons/myAppFast.ico"
    fileDescription = 'The lightning fast implementation'
}

task "MyApp-memory"(type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
    fileDescription = 'The default implementation with increased heap size'
    maxHeapPercent = 50
}

Running the createAllExecutables task will create the following executables in the launch4j folder located in the buildDir:

  • MyApp.exe
  • FastMyApp.exe
  • MyApp-memory.exe

Launch4jExternalTask

The section from above applies to this task, too. This task type has the following additional property:

  • String launch4jCmd = "launch4j"

In order to use a launch4j instance named 'launch4j-test' located in the PATH create a task like the following:

launch4j {
    mainClassName = 'com.example.myapp.Start'
}

task createMyApp(type: edu.sc.seis.launch4j.tasks.Launch4jExternalTask) {
    launch4jCmd = 'launch4j-test'
    outfile = 'MyApp.exe'
}

Kotlin

To get started using this plugin from a kotlin build script the above example from the section Launch4jLibraryTask would be written as:

tasks.withType<edu.sc.seis.launch4j.tasks.DefaultLaunch4jTask> {
    outfile = "${appName}.exe"
    mainClassName = mainClass
    icon = "$projectDir/icons/myApp.ico"
    productName = "My App"
}

tasks.register<edu.sc.seis.launch4j.tasks.Launch4jLibraryTask>("createFastStart") {
    outfile = "FastMyApp.exe"
    mainClassName = "com.example.myapp.FastStart"
    icon = "$projectDir/icons/myAppFast.ico"
    fileDescription = "The lightning fast implementation"
}
tasks.register<edu.sc.seis.launch4j.tasks.Launch4jLibraryTask>("MyApp-memory") {
    fileDescription = "The default implementation with increased heap size"
    maxHeapPercent = 50
}

Debugging

To get insight into the launch4j creation process start a launch4j task, e.g. createExe, createExecutables or your custom task, with the script parameter -Pl4j-debug. This will copy the created xml into ${buildDir}/tmp/${task.name}.

In order to debug the created executable call it with the command line argument --l4j-debug. This will create the log file launch4j.log next to the executable.

Using SNAPSHOT versions

When you report a bug and it got fixed, you will have access to some -SNAPSHOT version. Adjust your buildscript to use the OJO repo:

buildscript {
  repositories {
    jcenter()
    maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local/" }
  }
  dependencies {
    classpath 'edu.sc.seis.gradle:launch4j:latest.integration'
  }
}

apply plugin: 'edu.sc.seis.launch4j'

Contributors

See contributors for a complete list.

Version

See VERSION.md for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].