{"id":13565008,"url":"https://github.com/openjfx/javafx-gradle-plugin","last_synced_at":"2025-04-05T20:08:15.356Z","repository":{"id":33314556,"uuid":"157561783","full_name":"openjfx/javafx-gradle-plugin","owner":"openjfx","description":"Gradle plugin that makes it easy to work with JavaFX 11+","archived":false,"fork":false,"pushed_at":"2024-07-11T12:42:27.000Z","size":6894,"stargazers_count":365,"open_issues_count":54,"forks_count":62,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-29T19:03:00.645Z","etag":null,"topics":["gradle-plugin","javafx","javafx-gradle-plugin","javafx-modules"],"latest_commit_sha":null,"homepage":"https://openjfx.io/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openjfx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-11-14T14:34:34.000Z","updated_at":"2025-03-19T23:19:27.000Z","dependencies_parsed_at":"2024-08-01T13:21:32.818Z","dependency_job_id":"460b6e36-b474-49df-9d04-7c91e4fcc1f6","html_url":"https://github.com/openjfx/javafx-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openjfx%2Fjavafx-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openjfx%2Fjavafx-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openjfx%2Fjavafx-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openjfx%2Fjavafx-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openjfx","download_url":"https://codeload.github.com/openjfx/javafx-gradle-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393570,"owners_count":20931813,"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":["gradle-plugin","javafx","javafx-gradle-plugin","javafx-modules"],"created_at":"2024-08-01T13:01:39.145Z","updated_at":"2025-04-05T20:08:15.339Z","avatar_url":"https://github.com/openjfx.png","language":"Java","funding_links":[],"categories":["Java","Community"],"sub_categories":["Tools"],"readme":"# JavaFX Gradle Plugin\n\nSimplifies working with JavaFX 11+ for gradle projects.\n\n[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/org/openjfx/javafxplugin/org.openjfx.javafxplugin.gradle.plugin/maven-metadata.xml.svg?label=Gradle%20Plugin)](https://plugins.gradle.org/plugin/org.openjfx.javafxplugin)\n![Github Actions](https://github.com/openjfx/javafx-gradle-plugin/actions/workflows/build.yml/badge.svg)\n[![BSD-3 license](https://img.shields.io/badge/license-BSD--3-%230778B9.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\n## Getting started\n\nTo use the plugin, apply the following two steps:\n\n### 1. Apply the plugin\n\n##### Using the `plugins` DSL:\n\n**Groovy**\n\n    plugins {\n        id 'org.openjfx.javafxplugin' version '0.1.0'\n    }\n\n**Kotlin**\n\n    plugins {\n        id(\"org.openjfx.javafxplugin\") version \"0.1.0\"\n    }\n\n##### Alternatively, you can use the `buildscript` DSL:\n\n**Groovy**\n\n    buildscript {\n        repositories {\n            maven {\n                url \"https://plugins.gradle.org/m2/\"\n            }\n        }\n        dependencies {\n            classpath 'org.openjfx:javafx-plugin:0.1.0'\n        }\n    }\n    apply plugin: 'org.openjfx.javafxplugin'\n\n**Kotlin**\n\n    buildscript {\n        repositories {\n            maven {\n                setUrl(\"https://plugins.gradle.org/m2/\")\n            }\n        }\n        dependencies {\n            classpath(\"org.openjfx:javafx-plugin:0.1.0\")\n        }\n    }\n    apply(plugin = \"org.openjfx.javafxplugin\")\n\n\n### 2. Specify JavaFX modules\n\nSpecify all the JavaFX modules that your project uses:\n\n**Groovy**\n\n    javafx {\n        modules = [ 'javafx.controls', 'javafx.fxml' ]\n    }\n\n**Kotlin**\n\n    javafx {\n        modules(\"javafx.controls\", \"javafx.fxml\")\n    }\n    \n### 3. Specify JavaFX version\n\nTo override the default JavaFX version, a version string can be declared.\nThis will make sure that all the modules belong to this specific version:\n\n**Groovy**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    \u003cb\u003eversion = '17'\u003c/b\u003e\n    modules = [ 'javafx.controls', 'javafx.fxml' ]\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n**Kotlin**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    \u003cb\u003eversion = \"17\"\u003c/b\u003e\n    modules(\"javafx.controls\", \"javafx.fxml\")\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n### 4. Cross-platform projects and libraries\n\nThe plugin will include JavaFX dependencies for the current platform.\nHowever, a different target platform can also be specified.\n\nSupported targets are:\n\n* linux\n* linux-aarch64\n* win or windows\n* osx or mac or macos\n* osx-aarch64 or mac-aarch64 or macos-aarch64 (support added in JavaFX 11.0.12 LTS and JavaFX 17 GA)\n\n**Groovy**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    modules = [ 'javafx.controls', 'javafx.fxml' ]\n    \u003cb\u003eplatform = 'mac'\u003c/b\u003e\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n**Kotlin**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    modules(\"javafx.controls\", \"javafx.fxml\")\n    \u003cb\u003eplatform = 'mac'\u003c/b\u003e\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\n### 5. Dependency scope\n\nJavaFX application require native binaries for each platform to run.\nBy default, the plugin will include these binaries for the target platform.\nNative dependencies can be avoided by declaring the dependency configuration as **compileOnly**.\n\n**Groovy**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    modules = [ 'javafx.controls', 'javafx.fxml' ] \n    \u003cb\u003econfiguration = 'compileOnly'\u003c/b\u003e\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n**Kotlin**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    modules(\"javafx.controls\", \"javafx.fxml\")\n    \u003cb\u003econfiguration = \"compileOnly\"\u003c/b\u003e\n}\n\u003c/code\u003e\u003c/pre\u003e\n\nMultiple configurations can also be targeted by using `configurations`.\nFor example, JavaFX dependencies can be added to both `implementation` and `testImplementation`.\n\n**Groovy**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    modules = [ 'javafx.controls', 'javafx.fxml' ]\n    \u003cb\u003econfigurations = [ 'implementation', 'testImplementation' ]\u003c/b\u003e\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n**Kotlin**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    modules(\"javafx.controls\", \"javafx.fxml\")\n    \u003cb\u003econfigurations(\"implementation\", \"testImplementation\")\u003c/b\u003e\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n### 5. Using a local JavaFX SDK\n\nBy default, JavaFX modules are retrieved from Maven Central. \nHowever, a local JavaFX SDK can be used instead, for instance in the case of \na custom build of OpenJFX.\n\nSetting a valid path to the local JavaFX SDK will take precedence:\n\n**Groovy**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    \u003cb\u003esdk = '/path/to/javafx-sdk'\u003c/b\u003e\n    modules = [ 'javafx.controls', 'javafx.fxml' ]\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n**Kotlin**\n\n\u003cpre\u003e\u003ccode\u003e\njavafx {\n    \u003cb\u003esdk = \"/path/to/javafx-sdk\"\u003c/b\u003e\n    modules(\"javafx.controls\", \"javafx.fxml\")\n}\n\u003c/code\u003e\u003c/pre\u003e\n    \n## Issues and Contributions\n\nIssues can be reported to the [Issue tracker](https://github.com/openjfx/javafx-gradle-plugin/issues/).\n\nContributions can be submitted via [Pull requests](https://github.com/openjfx/javafx-gradle-plugin/pulls/), \nproviding you have signed the [Gluon Individual Contributor License Agreement (CLA)](https://cla.gluonhq.com/).\n\n## Migrating from 0.0.14 to 0.1.0\n\nVersion `0.1.0` introduced several changes and improvements, including lazy dependency declaration,\nvariant-aware dependency management, and support for Gradle's built-in JPMS functionality. In the\nprevious version, the classpath/module path was rewritten. This is no longer the case. As a result,\nyour past builds might be affected when you upgrade the plugin. In the next section, there are a few\ntroubleshooting steps that might help with the transition if you encounter issues when upgrading.\nThese examples are provided on a best-effort basis, but feel free to open an issue if you believe\nthere's a migration scenario not covered here that should be included.\n\n### Troubleshooting\n\n#### Gradle version\n\nThe plugin now requires `Gradle 6.1` or higher. Consider updating your Gradle settings, wrapper,\nand build to a more recent version of Gradle. Additionally, updating your plugins and dependencies\ncan help minimize issues with the plugin.\n\n#### Mixed JavaFX jars\n\nIf you encounter mixed classified JavaFX jars or see errors like `Error initializing QuantumRenderer: no\nsuitable pipeline found` during executing task like `build`, `test`, `assemble`, etc., it is likely one\nor more of your dependencies have published metadata that includes JavaFX dependencies with classifiers.\nThe ideal solution is to reach out to library authors to update their JavaFX plugin and publish a patch\nwith fixed metadata. A fallback solution to this is to `exclude group: 'org.openjfx'` on the dependencies\ncausing the issue.\n\n```groovy\nimplementation('com.example.fx:foo:1.0.0') {\n    exclude group: 'org.openjfx', module: '*'\n}\n```\n\n#### Variants\n\nIf you encounter errors such as `Cannot choose between the following variants of org.openjfx...` it is possible\nthat your build or another plugin is interacting with the classpath/module path in a way that \"breaks\" functionality\nprovided by this plugin. In such cases, you may need to re-declare the variants yourself as described in [Gradle docs\non attribute matching/variants](https://docs.gradle.org/current/userguide/variant_attributes.html) or reach out to\nthe plugin author in an attempt to remediate the situation.\n\n```groovy\n// Approach 1: Explicit Variant\n// The following snippet will let you add attributes for linux and x86_64 to a configuration\nconfigurations.someConfiguration {\n    attributes {\n        attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))\n        attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily, \"linux\"))\n        attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(MachineArchitecture, \"x86-64\"))\n    }\n}\n\n// Approach 2: Copy existing configuration into another configuration\nconfigurations.someConfiguration  {\n    def runtimeAttributes = configurations.runtimeClasspath.attributes\n    runtimeAttributes.keySet().each { key -\u003e\n        attributes.attribute(key, runtimeAttributes.getAttribute(key))\n    }\n}\n```\n\n#### Extra plugins\n\nIn versions `0.0.14` and below, there was a transitive dependency on `org.javamodularity.moduleplugin`.\nIf your **modular** project stops working after updating to `0.1.0` or above, it is likely that you need to\nexplicitly add the [org.javamodularity.moduleplugin](https://plugins.gradle.org/plugin/org.javamodularity.moduleplugin)\nback to your build and set `java.modularity.inferModulePath.set(false)` to keep things working as they were.\nThis plugin helped with transitive dependencies on legacy jars that haven't been modularized yet, but now you\nhave to option choose which approach to take. This change should not be required for non-modular projects.\n\n**Before**\n\n````groovy\nplugins {\n    id 'org.openjfx.javafxplugin' version '0.0.14'\n}\n````\n\n**After**\n\n````groovy\nplugins {\n    id 'org.openjfx.javafxplugin' version '0.1.0'\n    id 'org.javamodularity.moduleplugin' version '1.8.12'\n}\n\njava {\n    modularity.inferModulePath.set(false)\n}\n````\n\n**Note**: There are other recommended alternatives over `org.javamodularity.moduleplugin` for modular projects such as\n[extra-java-module-info](https://github.com/gradlex-org/extra-java-module-info) that would allow you to keep\n`inferModulePath` set to **true** by declaring missing module information from legacy jars. More details on how to\naccomplish can be found on the plugin's source code repository.\n\n#### Dependency hierarchy\n\nVersion `0.1.0` now relies on JavaFX modules defining their transitive modules rather than flattening them.\nThis change allows you to publish metadata declaring only the JavaFX modules you need, meaning it does not\ninclude transitive JavaFX modules as part of your published metadata.\n\nSome plugins rely on having all modules (transitive included) declared as \"top-level\" modules such as the\n`badass-runtime-plugin` on **non-modular** projects. In this particular case, it is necessary to declare\nall modules to restore previous functionality from `0.0.14` and below.\n\n**Before**\n\n````groovy\njavafx {\n    modules = ['javafx.controls']\n}\n````\n\n**After**\n\n````groovy\njavafx {\n    modules = ['javafx.base', 'javafx.graphics', 'javafx.controls']\n}\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenjfx%2Fjavafx-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenjfx%2Fjavafx-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenjfx%2Fjavafx-gradle-plugin/lists"}