{"id":25107345,"url":"https://github.com/samurai016/jre-maven-plugin","last_synced_at":"2026-06-22T19:31:05.959Z","repository":{"id":275155435,"uuid":"925226067","full_name":"Samurai016/jre-maven-plugin","owner":"Samurai016","description":"Maven plugin that bundles a JRE inside the project","archived":false,"fork":false,"pushed_at":"2025-02-10T21:49:55.000Z","size":456,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T08:17:49.817Z","etag":null,"topics":["adoptium","github-packages","java","jre","maven","maven-plugin"],"latest_commit_sha":null,"homepage":"https://samurai016.github.io/jre-maven-plugin/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Samurai016.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":"2025-01-31T13:28:56.000Z","updated_at":"2025-02-10T21:49:59.000Z","dependencies_parsed_at":"2025-01-31T15:30:24.166Z","dependency_job_id":"aa897ea5-afc9-4582-a358-1c51e77fbca7","html_url":"https://github.com/Samurai016/jre-maven-plugin","commit_stats":null,"previous_names":["samurai016/jre-maven-plugin"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samurai016%2Fjre-maven-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samurai016%2Fjre-maven-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samurai016%2Fjre-maven-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samurai016%2Fjre-maven-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Samurai016","download_url":"https://codeload.github.com/Samurai016/jre-maven-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246777815,"owners_count":20832033,"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":["adoptium","github-packages","java","jre","maven","maven-plugin"],"created_at":"2025-02-07T23:38:01.161Z","updated_at":"2026-06-22T19:31:05.927Z","avatar_url":"https://github.com/Samurai016.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JRE Maven Plugin\n[![Latest Version](https://img.shields.io/github/v/release/Samurai016/jre-maven-plugin?style=flat-square\u0026logo=github\u0026label=latest)](https://github.com/Samurai016/jre-maven-plugin/releases/latest)\n[![Static Badge](https://img.shields.io/badge/Maven%20Central-%23161b37?style=flat-square\u0026logo=sonatype\u0026logoColor=%23f18900)](https://mvnrepository.com/artifact/io.github.samurai016.plugins/jre-maven-plugin)\n[![Adoptium API](https://img.shields.io/badge/Adoptium%20API-%2314003c?style=flat-square\u0026logo=eclipseadoptium\u0026logoColor=%23ff1464\u0026labelColor=%2314003c)](https://adoptium.net/)\n\nThis Maven plugin allows you to bundle a JRE inside your project.  \nIt can download the JRE from [Adoptium](https://adoptium.net/) and optionally unzip it to a specified directory.\n\n## 🚀 Usage\n\nAdd the following to your `pom.xml` to use the plugin:\n\n```xml\n\u003cbuild\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eio.github.samurai016.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003ejre-maven-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e1.0.0\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003ejre-bundler\u003c/goal\u003e\n                    \u003c/goals\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n            \u003cconfiguration\u003e\n                \u003c!-- Optional: Configure the parameters as needed --\u003e\n                \u003cversion\u003e21\u003c/version\u003e\n                \u003coutputdir\u003e${project.build.directory}/bundled-jre\u003c/outputdir\u003e\n                \u003cunzipto\u003e${project.build.directory}/final-jre\u003c/unzipto\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/build\u003e\n```\n\n## 🔧 Plugin Parameters\n\n| Parameter        | Default Value                    | Description                                                                                                                                                                      |\n|------------------|----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `version`        | `${maven.compiler.source}`       | The version of the JRE to download. Specify a valid Java feature version (e.g., 8, 11, 17, 21).                                                                                  |\n| `jvmImpl`        | `hotspot`                        | The JVM implementation to download. Currently, only `hotspot` is supported. [See Adoptium V3 API docs for more details][adoptium-docs]                                           |\n| `architecture`   | `x64`                            | The architecture of the JRE to download (e.g., `x64`, `arm64`). [See Adoptium V3 API docs for more details][adoptium-docs]                                                       |\n| `os`             | `windows`                        | The operating system for the JRE (e.g., `windows`, `linux`, `mac`). [See Adoptium V3 API docs for more details][adoptium-docs]                                                   |\n| `imagetype`      | `jre`                            | The type of image to download. It is recommended to use the `jre` image type as it is the smallest version available. [See Adoptium V3 API docs for more details][adoptium-docs] |\n| `vendor`         | `eclipse`                        | The vendor providing the JRE. Currently, only `eclipse` (Adoptium) is supported. [See Adoptium V3 API docs for more details][adoptium-docs]                                      |\n| `outputdir`      | `${project.build.directory}/jre` | The directory where the JRE will be downloaded. You can use variables in the form `{{variable}}`.                                                                                |\n| `outputfilename` | `\u003crelease_name\u003e.zip`             | The name of the output file. If not specified, it will use the release name of the JRE with `.zip` appended if necessary.                                                        |\n| `unzipto`        | N/A                              | The directory where the JRE will be unzipped. If not specified, the JRE will not be unzipped.                                                                                    |\n| `movetoroot`     | `true`                           | If `true`, the contents of the first-level folder in the JRE zip will be moved to the root directory. If `false`, they will stay nested.                                         |\n\n## 🛠️ Example Configuration\n\n### Basic Example\n```xml\n\u003cconfiguration\u003e\n    \u003cversion\u003e21\u003c/version\u003e\n    \u003c!-- \u003cversion\u003e${maven.compiler.source}\u003c/version\u003e Uncomment this to use the same version as the project --\u003e\n    \u003coutputdir\u003e${project.build.directory}/bundled-jre\u003c/outputdir\u003e\n    \u003cunzipto\u003e${project.build.directory}/unpacked-jre\u003c/unzipto\u003e\n    \u003cmovetoroot\u003etrue\u003c/movetoroot\u003e\n\u003c/configuration\u003e\n```\n\n### Advanced Example\nIn this example, we specify all possible configuration options:\n\n```xml\n\u003cconfiguration\u003e\n    \u003cversion\u003e21\u003c/version\u003e\n    \u003cjvmImpl\u003ehotspot\u003c/jvmImpl\u003e\n    \u003carchitecture\u003ex64\u003c/architecture\u003e\n    \u003cos\u003elinux\u003c/os\u003e\n    \u003cimagetype\u003ejre\u003c/imagetype\u003e\n    \u003cvendor\u003eeclipse\u003c/vendor\u003e\n    \u003coutputdir\u003e${project.build.directory}/bundled-jre\u003c/outputdir\u003e\n    \u003coutputfilename\u003ejre.zip\u003c/outputfilename\u003e\n    \u003cunzipto\u003e${project.build.directory}/jre\u003c/unzipto\u003e\n    \u003cmovetoroot\u003etrue\u003c/movetoroot\u003e\n\u003c/configuration\u003e\n```\n### Real World Example\nIn this example, we use the same JRE version as the project and we use:  \n\n* **jre-maven-plugin** to bundle the JRE.\n* [maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-plugin/) to create a fat JAR (with dependencies).\n* [launch4j-maven-plugin](https://github.com/orphan-oss/launch4j-maven-plugin) to create an executable file for Windows which includes the JRE.  \n\nIn this way, we can create a standalone executable file that runs on Windows without requiring the user to have Java installed or to update any existing Java installations.\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cproject xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\u003e\n    \u003cmodelVersion\u003e4.0.0\u003c/modelVersion\u003e\n\n    \u003cgroupId\u003eio.github.samurai016.plugins.example\u003c/groupId\u003e\n    \u003cartifactId\u003ejre-maven-plugin-example\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.0-SNAPSHOT\u003c/version\u003e\n    \u003cpackaging\u003ejar\u003c/packaging\u003e\n\n    \u003cproperties\u003e\n        \u003cmaven.compiler.source\u003e21\u003c/maven.compiler.source\u003e\n        \u003cmaven.compiler.target\u003e21\u003c/maven.compiler.target\u003e\n        \u003cmaven.compiler.release\u003e21\u003c/maven.compiler.release\u003e\n        \u003cproject.build.sourceEncoding\u003eUTF-8\u003c/project.build.sourceEncoding\u003e\n        \u003capp.mainClass\u003eio.github.samurai016.plugins.example.App\u003c/app.mainClass\u003e\n    \u003c/properties\u003e\n\n    \u003cbuild\u003e\n        \u003cplugins\u003e\n            \u003c!-- Maven JRE Plugin: Bundle JRE --\u003e\n            \u003cplugin\u003e\n                \u003cgroupId\u003eio.github.samurai016.plugins\u003c/groupId\u003e\n                \u003cartifactId\u003ejre-maven-plugin\u003c/artifactId\u003e\n                \u003cversion\u003e1.0.0\u003c/version\u003e\n                \u003cexecutions\u003e\n                    \u003cexecution\u003e\n                        \u003cgoals\u003e\n                            \u003cgoal\u003ejre-bundler\u003c/goal\u003e\n                        \u003c/goals\u003e\n                    \u003c/execution\u003e\n                \u003c/executions\u003e\n                \u003cconfiguration\u003e\n                    \u003cversion\u003e${maven.compiler.release}\u003c/version\u003e\n                    \u003carchitecture\u003ex64\u003c/architecture\u003e\n                    \u003cimagetype\u003ejre\u003c/imagetype\u003e\n                    \u003cos\u003ewindows\u003c/os\u003e\n                    \u003cunzipto\u003etarget/jre\u003c/unzipto\u003e\n                \u003c/configuration\u003e\n            \u003c/plugin\u003e\n\n            \u003c!-- Maven Shade Plugin: Create a single executable jar --\u003e\n            \u003cplugin\u003e\n                \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n                \u003cartifactId\u003emaven-shade-plugin\u003c/artifactId\u003e\n                \u003cexecutions\u003e\n                    \u003cexecution\u003e\n                        \u003cphase\u003epackage\u003c/phase\u003e\n                        \u003cgoals\u003e\n                            \u003cgoal\u003eshade\u003c/goal\u003e\n                        \u003c/goals\u003e\n                        \u003cconfiguration\u003e\n                            \u003ctransformers\u003e\n                                \u003ctransformer\n                                        implementation=\"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer\"\u003e\n                                    \u003cmainClass\u003e${app.mainClass}\u003c/mainClass\u003e\n                                \u003c/transformer\u003e\n                                \u003ctransformer\n                                        implementation=\"org.apache.maven.plugins.shade.resource.ServicesResourceTransformer\"/\u003e\n                            \u003c/transformers\u003e\n                        \u003c/configuration\u003e\n                    \u003c/execution\u003e\n                \u003c/executions\u003e\n            \u003c/plugin\u003e\n\n            \u003c!-- Launch4j Maven Plugin: Create a Windows executable --\u003e\n            \u003cplugin\u003e\n                \u003cgroupId\u003ecom.akathist.maven.plugins.launch4j\u003c/groupId\u003e\n                \u003cartifactId\u003elaunch4j-maven-plugin\u003c/artifactId\u003e\n                \u003cexecutions\u003e\n                    \u003cexecution\u003e\n                        \u003cid\u003el4j-clui\u003c/id\u003e\n                        \u003cphase\u003epackage\u003c/phase\u003e\n                        \u003cgoals\u003e\n                            \u003cgoal\u003elaunch4j\u003c/goal\u003e\n                        \u003c/goals\u003e\n                        \u003cconfiguration\u003e\n                            \u003cheaderType\u003econsole\u003c/headerType\u003e\n                            \u003coutfile\u003etarget/${project.artifactId}.exe\u003c/outfile\u003e\n                            \u003cjar\u003etarget/${project.artifactId}.jar\u003c/jar\u003e\n                            \u003c!-- Other launch4j configuration options --\u003e\n                            \u003cjre\u003e\n                                \u003cpath\u003e./jre/${jre.version};%JAVA_HOME%;%PATH%\u003c/path\u003e\n                            \u003c/jre\u003e\n                        \u003c/configuration\u003e\n                    \u003c/execution\u003e\n                \u003c/executions\u003e\n            \u003c/plugin\u003e\n        \u003c/plugins\u003e\n    \u003c/build\u003e\n\u003c/project\u003e\n```\n \n\n\n## 🔍 How It Works\n1. **Parameter Configuration:** The plugin reads the configuration parameters specified in `pom.xml`.\n2. **Adoptium API Interaction:** It retrieves the latest available JRE version from Adoptium.\n3. **Download:** The JRE binary is downloaded to the specified output directory.\n4. **Unzip (Optional):** If the `unzipto` parameter is set, the JRE is extracted to the given directory.\n5. **Move to Root (Optional):** If `movetoroot` is `true`, the contents of the first-level folder in the archive are moved to the root.\n\n## 📌️ Example Directory Structure\n\nWith the following configuration:\n```xml\n\u003coutputdir\u003e${project.build.directory}/bundled-jre\u003c/outputdir\u003e\n\u003coutputfilename\u003ejre.zip\u003c/outputfilename\u003e\n\u003cunzipto\u003e${project.build.directory}/jre\u003c/unzipto\u003e\n\u003cmovetoroot\u003etrue\u003c/movetoroot\u003e\n```\nThe result will be:\n```\n/target/bundled-jre\n├── jre.zip\n/target/jre\n├── bin/\n├── lib/\n├── ...\n```\n\n## 💻 Development\nTo build and test the plugin locally, run:\n```sh\nmvn clean install\n```\n\n## 🛡️ License\nThis project is licensed under the [GNU General Public License v3.0](https://github.com/Samurai016/jre-maven-plugin/LICENSE.md).\n\n## 🤝 Contributing\nContributions are welcome! Please fork the repository and submit a pull request.\n\n## 🐛 Issues\nIf you encounter any problems, feel free to [open an issue](https://github.com/Samurai016/jre-maven-plugin/issues).\n\n## ❤️ Credits\nThanks to [Adoptium](https://adoptium.net/) for providing reliable JRE builds.\n\n[adoptium-docs]: https://api.adoptium.net/q/swagger-ui/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamurai016%2Fjre-maven-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamurai016%2Fjre-maven-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamurai016%2Fjre-maven-plugin/lists"}