{"id":13670859,"url":"https://github.com/TheBoegl/gradle-launch4j","last_synced_at":"2025-04-27T13:33:04.967Z","repository":{"id":32265760,"uuid":"35840295","full_name":"TheBoegl/gradle-launch4j","owner":"TheBoegl","description":"A gradle-plugin to create windows executables with launch4j","archived":false,"fork":false,"pushed_at":"2025-01-26T17:41:36.000Z","size":1140,"stargazers_count":316,"open_issues_count":8,"forks_count":43,"subscribers_count":12,"default_branch":"develop","last_synced_at":"2025-01-26T18:30:52.060Z","etag":null,"topics":["executable","gradle","gradle-plugin","launch4j"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheBoegl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-18T20:18:10.000Z","updated_at":"2025-01-26T17:41:32.000Z","dependencies_parsed_at":"2024-01-14T16:14:49.586Z","dependency_job_id":"d08ae526-c66e-4b30-a0b1-3d367f2c9269","html_url":"https://github.com/TheBoegl/gradle-launch4j","commit_stats":null,"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBoegl%2Fgradle-launch4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBoegl%2Fgradle-launch4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBoegl%2Fgradle-launch4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheBoegl%2Fgradle-launch4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheBoegl","download_url":"https://codeload.github.com/TheBoegl/gradle-launch4j/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251145729,"owners_count":21543090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["executable","gradle","gradle-plugin","launch4j"],"created_at":"2024-08-02T09:00:51.027Z","updated_at":"2025-04-27T13:32:59.946Z","avatar_url":"https://github.com/TheBoegl.png","language":"Groovy","funding_links":[],"categories":["开发运维工具"],"sub_categories":[],"readme":"[ ![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/edu.sc.seis.launch4j)](https://plugins.gradle.org/plugin/edu.sc.seis.launch4j)\n\n**Build status**:\n[ ![Build status master](https://ci.appveyor.com/api/projects/status/xscd7594tneg721r/branch/master?svg=true\u0026passingText=master%20-%20OK\u0026failingText=master%20-%20Fails\u0026pendingText=master%20-%20pending)](https://ci.appveyor.com/project/TheBoegl/gradle-launch4j/branch/master)\n[ ![Build status develop](https://ci.appveyor.com/api/projects/status/xscd7594tneg721r/branch/develop?svg=true\u0026passingText=develop%20-%20OK\u0026failingText=develop%20-%20Fails\u0026pendingText=develop%20-%20pending)](https://ci.appveyor.com/project/TheBoegl/gradle-launch4j/branch/develop)\n\n**Table of contents**\n* [Introduction](#introduction)\n* [Tasks](#tasks)\n* [Configuration](#configuration)\n* [Launch4jLibraryTask](#launch4jlibrarytask)\n* [Launch4jExternalTask](#launch4jexternaltask)\n* [Kotlin](#kotlin)\n* [Contributors](#contributors) (see [Contributors](graphs/contributors))\n* [Version](#version) (see [VERSION.md](VERSION.md))\n\n# Introduction\n\nThe gradle-launch4j plugin uses [launch4j](http://launch4j.sourceforge.net/) [3.50](src/main/groovy/edu/sc/seis/launch4j/Launch4jPlugin.groovy) to create windows .exe files for java applications.\nThis plugin is compatible with the Gradle versions 4.10 and later.\nIf you still rely on an outdated gradle version `[2-4.10[`, use the plugin version [2.5.4](https://github.com/TheBoegl/gradle-launch4j/tree/v2.5.4).\n\nSince **version 2.5** this plugin requires **Java 8*, as launch4j in version 3.14 and later requires that as well.\nIf you are still forced to work with Java 6, use the plugin version [2.4.9](https://github.com/TheBoegl/gradle-launch4j/tree/v2.4.9).\n\n# Tasks\n\nThere are 2 tasks:\n\n* **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. \n* createAllExecutables - Helper task to run all tasks of the `Launch4jExternalTask` and `Launch4jLibraryTask` type.\n\nLaunch4j 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](#launch4jexternaltask) to create your executable.\n\n# Configuration\n\nThe 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\nvalue is the `mainClassName`.\n\n## How to include\nAn example configuration within your `build.gradle` for use in all Gradle versions might look like:\n\n    plugins {\n      id 'java'\n      id 'edu.sc.seis.launch4j' version '3.0.6'\n    }\n\n    launch4j {\n      mainClassName = 'com.example.myapp.Start'\n      icon = \"${projectDir}/icons/myApp.ico\"\n    }\n\nThe same script snippet for using [legacy plugin application](https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application):\n\n    buildscript {\n      repositories {\n        gradlePluginPortal()\n      }\n      dependencies {\n        classpath 'edu.sc.seis.launch4j:launch4j:3.0.6'\n      }\n    }\n\n    repositories {\n      mavenCentral()\n    }\n\n    apply plugin: 'java'\n    apply plugin: 'edu.sc.seis.launch4j'\n\n    launch4j {\n      mainClassName = 'com.example.myapp.Start'\n      icon = \"${projectDir}/icons/myApp.ico\"\n    }\n\nIf no repository is configured before applying this plugin the *Maven central* repository will be added to the project.\n\nSee the [Gradle User guide](http://gradle.org/docs/current/userguide/custom_plugins.html#customPluginStandalone) for more information on how to use a custom plugin and the [plugin page](https://plugins.gradle.org/plugin/edu.sc.seis.launch4j) for the above settings.\n\n## How to configure\n\nThe values configurable within the launch4j extension along with their defaults are:\n\n| Property Name | Default Value | Comment |\n|---------------|---------------|---------|\n| 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.|\n| String libraryDir | \"lib\" | The library directory next to the created executable, where all dependencies, i.e. libraries, will be copied into. |\n| Object copyConfigurable | null | User-defined set of files to copy to`libraryDir` (if not set, the default copy logic is used) |\n| Set\u0026lt;String\u0026gt; classpath| [] | User-defined classpath property (if not set, the default logic based on the set of files copied to `libraryDir` is used) |\n| String xmlFileName | \"launch4j.xml\" | |\n| String mainClassName | | |\n| boolean dontWrapJar | false | |\n| String headerType | \"gui\" | |\n| Task jarTask | tasks[jar], if the JavaPlugin is loaded | The jar producing task. See [here](#configurable-input-configuration) how to use this for the shadow plugin. |\n| String outfile | project.name+'.exe' | |\n| String errTitle | \"\" | |\n| String cmdLine | \"\" | |\n| String chdir | '.' | After launching, '.' changes working directory to directory of executable, or '' to not change. Note that env variable `%OLDPWD%` contains the original working directory and can be passed on launch to your application if needed. |\n| String priority | 'normal' | |\n| String downloadUrl | \"http://java.com/download\" | |\n| String supportUrl | \"\" | |\n| boolean stayAlive | false | |\n| boolean restartOnCrash | false | |\n| String manifest | \"\" | |\n| String icon | \"\" | A relative path from the outfile or an absolute path to the icon file. If you are unsure, use \"${projectDir}/path/to/icon.ico\" |\n| String version | project.version | |\n| String textVersion | project.version | |\n| String copyright | \"unknown\" | |\n| String companyName | \"\" | |\n| String fileDescription | project.name | |\n| String productName | project.name | |\n| String internalName | project.name | |\n| String trademarks | | |\n| String language | \"ENGLISH_US\" | |\n| Set\u0026lt;String\u0026gt; jvmOptions | [ ] | |\n| String bundledJrePath | | |\n| boolean requires64Bit | false | |\n| String jreMinVersion | project.targetCompatibility or\u003cbr\u003e the current java version,\u003cbr\u003e if the property is not set | |\n| String jreMaxVersion | | |\n| Set\u0026lt;String\u0026gt; variables | [ ] | |\n| String mutexName | | |\n| String windowTitle | | |\n| String messagesStartupError | | |\n| String messagesJreNotFoundError | | |\n| String messagesJreVersionError | | |\n| String messagesLauncherError | | |\n| String messagesInstanceAlreadyExists | | |\n| Integer initialHeapSize | | |\n| Integer initialHeapPercent | | |\n| Integer maxHeapSize | | |\n| Integer maxHeapPercent | | |\n| String splashFileName | | A relative path from the outfile or an absolute path to the bmp splash file. |\n| boolean splashWaitForWindows | true | |\n| Integer splashTimeout | 60 | |\n| boolean splashTimeoutError | true | |\n| DuplicatesStrategy duplicatesStrategy | DuplicatesStrategy.EXCLUDE | The duplication strategy to use when duplicates are found. See also [here](https://docs.gradle.org/current/javadoc/org/gradle/api/file/DuplicatesStrategy.html).|\n\n| Removed properties                 | Default Value | Description                          |\n|------------------------------------|---------------|--------------------------------------|\n| ~~boolean bundledJreAsFallback~~   | false         |                                      |\n| ~~boolean bundledJre64Bit~~        | false         | use requires64Bit instead            |\"\n| ~~jar~~                            | \"lib/\"+project.tasks[jar].archiveName\u003cbr/\u003eor\u003cbr/\u003e\"\", if the JavaPlugin is not loaded |    |\n| ~~String jdkPreference~~           | \"preferJre\"   | use requiresJdk instead              |\n| ~~String jreRuntimeBits~~          | \"64/32\"       | use requires64Bit instead            |\n| ~~String messagesBundledJreError~~ |               | use messagesJreNotFoundError instead |\n\n### Configurable input configuration\n\nIn order to configure the input of the *copyL4jLib* task set the `copyConfigurable` property.\nThe following example shows how to use this plugin hand in hand with the shadow plugin:\n\n    launch4j {\n        outfile = 'TestMain.exe'\n        mainClassName = project.mainClassName\n        copyConfigurable = []\n        jarTask = project.tasks.shadowJar\n    }\n\nIf you use the outdated fatJar plugin the following configuration correctly wires the execution graph:\n\n    fatJar {\n        classifier 'fat'\n        with jar\n        manifest {\n            attributes 'Main-Class': project.mainClassName\n        }\n    }\n    \n    fatJarPrepareFiles.dependsOn jar\n    \n    launch4j {\n        outfile = 'TestMain.exe'\n        mainClassName = project.mainClassName\n        copyConfigurable = []\n        jarTask = project.tasks.fatJar\n    }\n\n# Launch4jLibraryTask\nThis task type can be used to build multiple executables with Launch4j. The default launch4j configuration from [how to configure](#how-to-configure) is used for the default values but can be adjusted.\nTo 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).\n\nCreating three executables is as easy as:\n\n    launch4j {\n        outfile = 'MyApp.exe'\n        mainClassName = 'com.example.myapp.Start'\n        icon = \"${projectDir}/icons/myApp.ico\"\n        productName = 'My App'\n    }\n    \n    tasks.register('createFastStart', edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {\n        outfile = 'FastMyApp.exe'\n        mainClassName = 'com.example.myapp.FastStart'\n        icon = \"${projectDir}/icons/myAppFast.ico\"\n        fileDescription = 'The lightning fast implementation'\n    }\n    \n    tasks.register('MyApp-memory', edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {\n        fileDescription = 'The default implementation with increased heap size'\n        maxHeapPercent = 50\n    }\n\nRunning the `createAllExecutables` task will create the following executables in the launch4j folder located in the buildDir:\n* MyApp.exe\n* FastMyApp.exe\n* MyApp-memory.exe\n\n# Launch4jExternalTask\nThe [section from above](#launch4jlibrarytask) applies to this task, too.\nThis task type has the following additional property:\n\n* String launch4jCmd = \"launch4j\"\n\nIn order to use a launch4j instance named 'launch4j-test' located in the PATH create a task like the following:\n\n    launch4j {\n        mainClassName = 'com.example.myapp.Start'\n    }\n    \n    task createMyApp(type: edu.sc.seis.launch4j.tasks.Launch4jExternalTask) {\n        launch4jCmd = 'launch4j-test'\n        outfile = 'MyApp.exe'\n    }\n# Using another launch4j binary\nTo use a different launch4j binary instead of the default one, you can provide it as follows. Use your desired version instead of 3.50.\n\n    dependencies {\n        launch4jBin 'net.sf.launch4j:launch4j:3.50:workdir-win32'\n    }\n# Kotlin\n\nTo get started using this plugin from a kotlin build script the above example from [the section Launch4jLibraryTask](#launch4jlibrarytask) would be written as:\n```kotlin\n\ntasks.withType\u003cedu.sc.seis.launch4j.tasks.DefaultLaunch4jTask\u003e {\n    outfile.set(\"${appName}.exe\")\n    mainClassName.set(mainClass)\n    icon.set(\"$projectDir/icons/myApp.ico\")\n    productName.set(\"My App\")\n}\n\ntasks.register\u003cedu.sc.seis.launch4j.tasks.Launch4jLibraryTask\u003e(\"createFastStart\") {\n    outfile.set(\"FastMyApp.exe\")\n    mainClassName.set(\"com.example.myapp.FastStart\")\n    icon.set(\"$projectDir/icons/myAppFast.ico\")\n    fileDescription.set(\"The lightning fast implementation\")\n}\ntasks.register\u003cedu.sc.seis.launch4j.tasks.Launch4jLibraryTask\u003e(\"MyApp-memory\") {\n    fileDescription.set(\"The default implementation with increased heap size\")\n    maxHeapPercent.set(50)\n}\n```\n\n# Debugging\nTo 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}`.\n\nIn 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.\n\n# Using `SNAPSHOT` versions\n\nWhen you report a bug and it got fixed, you will have access to some `-SNAPSHOT` version.\nAdjust your buildscript to use the artifactory OSS repo:\n```gradle\nbuildscript {\n  repositories {\n    maven { url 'https://boegl.jfrog.io/artifactory/snapshots-gradle-dev-local/' }\n  }\n  dependencies {\n    classpath 'edu.sc.seis.launch4j:launch4j:latest.integration'\n  }\n}\n\napply plugin: 'edu.sc.seis.launch4j'\n```\n\n# Contributors\n\n* [Sebastian Bögl](https://github.com/TheBoegl) (Maintainer)\n* [Philip Crotwell](https://github.com/crotwell) (Creator)\n\nSee [contributors](graphs/contributors) for a complete list. \n\n# Version\n\nSee [VERSION.md](VERSION.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheBoegl%2Fgradle-launch4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTheBoegl%2Fgradle-launch4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheBoegl%2Fgradle-launch4j/lists"}