Skip to content

Convenient Exe Task

alessandroscarlatti edited this page May 24, 2018 · 11 revisions

You want to create a great-looking distributable exe quickly. This is now easily configurable with the Launch4jTemplateTask Gradle task.

How to Use

Pull in the dependency. For the time being this would be from a repo in your project source code. The repo should be in Maven format. Just unzip the jar into your repo directory.

buildscript {
    repositories {
        jcenter()
        maven {
            url "C:/Users/pc/my-project-repo/lib"
        }
    }
    dependencies {
        classpath 'com.scarlatti:launch4j-gradle-plugin:+'
    }
}

Example syntax:

task communityDisributionGuiExe(type: Launch4jExeTemplateTask) {
	resourcesDir = "/release/community/gui"

        // configure the actual launch4j task
	config {
		myCustomProperty = "someCustomValue"
		dependsOn someCustomJarTask
		copyConfigurable = someCustomJarTask.outputs.files
	}
}

Properties: https://github.com/alessandroscarlatti/launch4j-gradle-plugin/blob/rewrite_syntax/docs.csv

An exe build with launch4j needs several resource files, such as an icon, splash, manifest, for example. This task will take an opinionated approach that all of these files should be in a single directory, with conventional names. However, those files should be able to be overriden by configuration of the actual launch4j task.

Property Function Notes
iconPath
splashPath
manifestPath
propertiesPath

Configurable via the above, in addition to:

resourcesDir(String resourceDir) (plus overloads)

Clone this wiki locally