Convenient Exe Task - alessandroscarlatti/launch4j-gradle-plugin GitHub Wiki

You want to package your jar as a great-looking exe quickly. This is easier than ever with the Launch4jTemplateTask Gradle task.

How to Use

Pull in the dependency.

buildscript {
    repositories {
        jcenter()  // for plugin dependencies
        maven {
            url "https://dl.bintray.com/alessandroscarlatti/maven"
        }
    }
    dependencies {
        classpath 'com.scarlatti:launch4j-gradle-plugin:1.0.1'
    }
}

apply plugin: 'java'  // and other plugins...
apply plugin: 'com.scarlatti.launch4j.integration'

Configure an exe

If your build produces an executable jar this can be extremely simple.

import com.scarlatti.launch4j.Launch4jTemplateTask

task simpleExe(type: Launch4jTemplateTask) {
}

Go ahead and run the simpleExe task. You should now have an exe waiting for you at /build/launch4j/basicExe/basicExe.exe.

That's it.

Congratulations!

Add an Icon

The Launch4jTemplateTask takes an opinionated view on providing resources, such as an icon. You may provide an icon (.ico) file at /exe/icon.ico and the task will automatically use it for the exe.

Add a Splash Screen

You may provide an splash (.bmp only) file at /exe/splash.bmp and the task will automatically use it for the exe.

Expert Options

Of course, properties of the actual Launch4j task can be configured.

task simpleExe(type: Launch4jExeTemplateTask) {

    // configure the actual launch4j task
    // more details at https://github.com/TheBoegl/gradle-launch4j
    config {
        companyName = "My Awesome Company"
    }
}

The Launch4j plugin documentation provides details on all the configuration options available.