{"id":15069492,"url":"https://github.com/raydac/mvn-jlink","last_synced_at":"2025-08-22T05:30:55.504Z","repository":{"id":45978083,"uuid":"162806930","full_name":"raydac/mvn-jlink","owner":"raydac","description":"Maven plugin provides a way to load JDK and use its tools during project build","archived":false,"fork":false,"pushed_at":"2024-09-07T11:51:36.000Z","size":14979,"stargazers_count":43,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-08T03:51:33.422Z","etag":null,"topics":["java","jdeps","jlink","maven","maven-plugin","openjdk","plugin","prebuilt-distributives"],"latest_commit_sha":null,"homepage":"","language":"Java","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/raydac.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","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-12-22T11:49:38.000Z","updated_at":"2024-09-08T06:18:14.000Z","dependencies_parsed_at":"2024-05-18T10:31:04.932Z","dependency_job_id":"2df11a9f-edc3-4901-b234-3010a102b591","html_url":"https://github.com/raydac/mvn-jlink","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-jlink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-jlink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-jlink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raydac%2Fmvn-jlink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raydac","download_url":"https://codeload.github.com/raydac/mvn-jlink/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230561013,"owners_count":18245324,"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":["java","jdeps","jlink","maven","maven-plugin","openjdk","plugin","prebuilt-distributives"],"created_at":"2024-09-25T01:42:51.088Z","updated_at":"2024-12-20T09:06:11.846Z","avatar_url":"https://github.com/raydac.png","language":"Java","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=AHWJHJFBAWGL2"],"categories":[],"sub_categories":[],"readme":"[![License Apache 2.0](https://img.shields.io/badge/license-Apache%20License%202.0-green.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n[![Java 11+](https://img.shields.io/badge/java-11.0%2b-green.svg)](https://bell-sw.com/pages/downloads/)\n[![Maven central](https://maven-badges.herokuapp.com/maven-central/com.igormaznitsa/mvn-jlink-wrapper/badge.svg)](http://search.maven.org/#artifactdetails|com.igormaznitsa|mvn-jlink-wrapper|1.2.4|jar)\n[![Maven 3.3.9+](https://img.shields.io/badge/maven-3.3.9%2b-green.svg)](https://maven.apache.org/)\n[![PayPal donation](https://img.shields.io/badge/donation-PayPal-cyan.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=AHWJHJFBAWGL2)\n[![YooMoney donation](https://img.shields.io/badge/donation-Yoo.money-blue.svg)](https://yoomoney.ru/to/41001158080699)\n\n![logo](assets/logo_git.png)\n\n# Changelog\n\n__1.2.4 (07-sep-2024)__\n\n- added `ADOPTIUM_API` provider for ADOPTIUM API REST calls [#15](https://github.com/raydac/mvn-jlink/issues/14)\n- fixed pattern to extract build version and extensions for ADOPTIUM\n  provider [#14](https://github.com/raydac/mvn-jlink/issues/15)\n- updated dependencies\n\n__1.2.3 (24-jun-2024)__\n\n- fixed MAC OS detection for Adopt JDK provider [#13](https://github.com/raydac/mvn-jlink/issues/13)\n- updated dependencies\n\n[full changelog](CHANGELOG.txt)\n\n# Introduction\n\nSince Java 9, the JDK introduced modules through Project Jigsaw, providing a streamlined approach to building custom JDK\nversions containing only the necessary modules. These tailored JDK images can be bundled with Java applications for\noptimized deployment. Given my involvement in several Java-based open-source projects, such\nas [SciaReto](http://www.igormaznitsa.com/netbeans-mmd-plugin/) and\nthe [ZXPoly emulator](https://github.com/raydac/zxpoly), I recognized the benefit of offering pre-built JDK images with\nthese applications. To automate the creation of these images, I developed a Maven plugin, as Maven is my primary tool\nfor managing OSS projects.\n\n# What does it do?\n\nThe functionality of the plugin is straightforward: it allows the execution of tools located in the JDK's bin directory,\nsuch as `jdeps` and `jlink`. In cases where a specific JDK version is required to create an image, the plugin includes\nan internal mechanism that automatically downloads the necessary version of OpenJDK from a designated provider, unpacks\nit,\nand makes it available for building the JDK image.\n\nAt present the plug-in supports listed OpenJDK providers:\n\n* __LOCAL__ - locally provided JDK will be used for operations\n* __URL__ - load archive through directly provided URL with optional check of file digest (sha1, sha256, sha384, sha512,\n  md2, md3)\n* __[MICROSOFT](https://www.microsoft.com/openjdk)__ - Prebuilt binary archives of Microsoft OpenJDK\n* __[BELLSOFT](https://www.bell-sw.com/java.html)__ - _(Git based)_ Prebuilt binary archives of OpenJDK 'LIBERICA' for\n  many platforms including embedded ones, __it has versions includes JavaFX module__.\n* __[ADOPTIUM_API](https://api.adoptium.net/q/swagger-ui/)__ - _(REST API based)_ Prebuilt binary archives of OpenJDK\n  Eclipse Adoptium for many\n  platforms, downloading through REST API.\n* __[ADOPTIUM](https://adoptium.net/)__ - _(Git based)_ Prebuilt binary archives of OpenJDK Eclipse Adoptium for many\n  platforms.\n* __[SAPMACHINE](https://github.com/SAP/SapMachine)__ - _(Git based)_ Prebuilt binary archives of OpenJDK provided by\n  SAP.\n* __[GRAALVMCE](https://github.com/graalvm/graalvm-ce-builds)__ - _(Git based)_ Prebuilt JDK distributives of GraalVM\n  Community Edition.\n\n\u003e **Warning**  \n\u003e For Git based providers, it is possible to tune page size during search through `perPage` parameter (by default 40).\n\u003e Also it is possible to disable check of digests through configuration boolean `check` parameter (which by default\n\u003e true).\n\n# Goals and parameters\n\nAll JDK provider parameter info you can get through [the mind map](./assets/mindmap.png).\n\n## Goal `cache-jdk`\n\nThe goal is to download the JDK from a specified provider, unpack it, and store the JDK folder path in a custom-named\nMaven project property. This property can then be utilized by other plugins within the project.\n\n### Examples\n\nThe provided code snippet illustrates the caching mechanism for JDK downloads via a direct URL. When executed, the JDK\nis automatically downloaded and unpacked into the plugin's cache directory. Subsequently, the path to the cached JDK is\nmade available to the Maven project through the `jlink.jdk.path` property.\n\n```xml\n\n\u003cplugin\u003e\n  \u003cgroupId\u003ecom.igormaznitsa\u003c/groupId\u003e\n  \u003cartifactId\u003emvn-jlink-wrapper\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.4\u003c/version\u003e\n  \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cid\u003ecache-jdk18-openjdk-x64\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ecache-jdk\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cid\u003edo-cache-jdk\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ecache-jdk\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n                \u003cjdkPathProperty\u003ejlink.jdk.path\u003c/jdkPathProperty\u003e\n                \u003cjdkCachePath\u003e${project.build.directory}${file.separator}jdkCache\u003c/jdkCachePath\u003e\n\n                \u003cprovider\u003eURL\u003c/provider\u003e\n                \u003cproviderConfig\u003e\n                    \u003cid\u003eopenjdk-18-linux-x64\u003c/id\u003e\n                    \u003curl\u003e\n                        https://download.java.net/java/GA/jdk18.0.2/f6ad4b4450fd4d298113270ec84f30ee/9/GPL/openjdk-18.0.2_linux-x64_bin.tar.gz\n                    \u003c/url\u003e\n                    \u003csha256\u003ecf06f41a3952038df0550e8cbc2baf0aa877c3ba00cca0dd26f73134f8baf0e6\u003c/sha256\u003e\n                \u003c/providerConfig\u003e\n            \u003c/configuration\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n\u003c/plugin\u003e\n```\n\nThe code snippet demonstrates the caching of GraalVM Community Edition (CE). The GraalVM distribution will be\nautomatically\ndownloaded and unpacked into the plugin's cache. Its path will then be supplied to the Maven project via the\n`jlink.jdk.path` property.\n\n```xml\n\n\u003cplugin\u003e\n  \u003cgroupId\u003ecom.igormaznitsa\u003c/groupId\u003e\n  \u003cartifactId\u003emvn-jlink-wrapper\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.4\u003c/version\u003e\n  \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cid\u003ecache-jdk17-graalvmce\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ecache-jdk\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cid\u003edo-cache-jdk\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ecache-jdk\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n                \u003cjdkPathProperty\u003ejlink.jdk.path\u003c/jdkPathProperty\u003e\n                \u003cjdkCachePath\u003e${project.build.directory}${file.separator}jdkCache\u003c/jdkCachePath\u003e\n\n                \u003cprovider\u003eGRAALVMCE\u003c/provider\u003e\n                \u003cproviderConfig\u003e\n                    \u003ctype\u003ejava17\u003c/type\u003e\n                    \u003cversion\u003e22.2.0\u003c/version\u003e\n                    \u003carch\u003eamd64\u003c/arch\u003e\n                \u003c/providerConfig\u003e\n            \u003c/configuration\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n\u003c/plugin\u003e\n```\n\nThe code snippet illustrates the configuration to cache OpenJDK from the ADOPTION provider within the project's build\nfolder.\nThe path to this folder is then stored in the `jlink.jdk.path` project property.\n\n```xml\n\n\u003cplugin\u003e\n  \u003cgroupId\u003ecom.igormaznitsa\u003c/groupId\u003e\n  \u003cartifactId\u003emvn-jlink-wrapper\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.4\u003c/version\u003e\n  \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cid\u003ecache-jdk-8\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ecache-jdk\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n                \u003cjdkPathProperty\u003ejlink.jdk.path\u003c/jdkPathProperty\u003e\n                \u003cjdkCachePath\u003e${project.build.directory}${file.separator}jdkCache\u003c/jdkCachePath\u003e\n\n                \u003cprovider\u003eADOPTIUM\u003c/provider\u003e\n                \u003cproviderConfig\u003e\n                    \u003cversion\u003e8U\u003c/version\u003e\n                    \u003carch\u003ex64\u003c/arch\u003e\n                    \u003ctype\u003ejdk\u003c/type\u003e\n                    \u003cimpl\u003ehotspot\u003c/impl\u003e\n                    \u003cbuild\u003e8u332b09\u003c/build\u003e\n                \u003c/providerConfig\u003e\n            \u003c/configuration\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n\u003c/plugin\u003e\n```\n\n## Goal `jdeps`\n\nThe goal automates work with `JDK/bin/jdeps` utility, it allows to get list of modules needed by a JAR and save result\ninto a file.\n\n### Example\n\nThe example calls jdeps tool from provided JDK over project jar file and saves output into `jdeps.out` situated in\nproject build folder.\n\n```xml\n\n\u003cplugin\u003e\n  \u003cgroupId\u003ecom.igormaznitsa\u003c/groupId\u003e\n  \u003cartifactId\u003emvn-jlink-wrapper\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.4\u003c/version\u003e\n  \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cid\u003ecall-jdeps\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ejdeps\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n                \u003coutput\u003e${project.build.directory}${file.separator}jdeps.out\u003c/output\u003e\n                \u003coptions\u003e\n                    \u003coption\u003e${project.build.directory}${file.separator}${project.build.finalName}.jar\u003c/option\u003e\n                \u003c/options\u003e\n            \u003c/configuration\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n\u003c/plugin\u003e\n```\n\n## Goal `jlink`\n\nThe goal automates work with `JDK/bin/jlink` utility, it allows to build JDK image based on `jdeps` output.\n\n### Example\n\nThe example calls `jlink` from provided JDK and build JDK version based on report provided by `jdeps` tool in\n`jdeps.out` file, also `java.compiler` module will be added. The prepared JDK version will be presented in project build\nfolder, subfolder `preparedJDK`\n\n```xml\n\n\u003cplugin\u003e\n  \u003cgroupId\u003ecom.igormaznitsa\u003c/groupId\u003e\n  \u003cartifactId\u003emvn-jlink-wrapper\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.4\u003c/version\u003e\n  \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cid\u003ecall-jlink\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ejlink\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n                \u003cjdepsReportPath\u003e${project.build.directory}${file.separator}jdeps.out\u003c/jdepsReportPath\u003e\n                \u003coutput\u003e${project.build.directory}${file.separator}preparedJDK\u003c/output\u003e\n                \u003cmodulePaths\u003e\n                    \u003cpath\u003e${java.home}${file.separator}jmods\u003c/path\u003e\n                \u003c/modulePaths\u003e\n                \u003caddModules\u003e\n                    \u003cmodule\u003ejava.compiler\u003c/module\u003e\n                \u003c/addModules\u003e\n                \u003coptions\u003e\n                    \u003coption\u003e--compress=2\u003c/option\u003e\n                    \u003coption\u003e--no-header-files\u003c/option\u003e\n                    \u003coption\u003e--no-man-pages\u003c/option\u003e\n                \u003c/options\u003e\n            \u003c/configuration\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n\u003c/plugin\u003e\n```\n\n## Goal `jdk-tool`\n\nIt is a universal goal, it allows to make call to any tool situated in `JDK/bin` and save its output into files.\n\n### Example\n\nThe example calls jps tool from provided tool JDK with 5 seconds timeout and its output will be written into `jps.out`\nfile.\n\n```xml\n\n\u003cplugin\u003e\n  \u003cgroupId\u003ecom.igormaznitsa\u003c/groupId\u003e\n  \u003cartifactId\u003emvn-jlink-wrapper\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.3\u003c/version\u003e\n  \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cid\u003ecall-tool\u003c/id\u003e\n            \u003cphase\u003epackage\u003c/phase\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ejdk-tool\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n                \u003coutput\u003e${project.build.directory}${file.separator}jps.out\u003c/output\u003e\n                \u003ctool\u003ejps\u003c/tool\u003e\n                \u003ctimeout\u003e5\u003c/timeout\u003e\n                \u003coptions\u003e\n                    \u003coption\u003e-m\u003c/option\u003e\n                \u003c/options\u003e\n            \u003c/configuration\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n\u003c/plugin\u003e\n```\n\n# Mind Map of all plug-in parameters\n\nCreated with [SciaReto](http://sciareto.org)   \n![mindmap](https://raw.githubusercontent.com/raydac/mvn-jlink/master/assets/mindmap.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraydac%2Fmvn-jlink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraydac%2Fmvn-jlink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraydac%2Fmvn-jlink/lists"}