{"id":18559053,"url":"https://github.com/linux-china/toolchains-maven-plugin","last_synced_at":"2025-04-10T02:30:37.671Z","repository":{"id":40274525,"uuid":"421591758","full_name":"linux-china/toolchains-maven-plugin","owner":"linux-china","description":"Toolchains Maven Plugin with JDK auto download","archived":false,"fork":false,"pushed_at":"2023-06-27T05:10:46.000Z","size":363,"stargazers_count":41,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T02:51:14.896Z","etag":null,"topics":["maven-plugin","toolchains"],"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/linux-china.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2021-10-26T21:38:50.000Z","updated_at":"2025-01-20T10:28:17.000Z","dependencies_parsed_at":"2024-11-06T21:45:03.139Z","dependency_job_id":"74ab5069-4da6-4da6-8a25-76c5ea18394e","html_url":"https://github.com/linux-china/toolchains-maven-plugin","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Ftoolchains-maven-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Ftoolchains-maven-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Ftoolchains-maven-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Ftoolchains-maven-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linux-china","download_url":"https://codeload.github.com/linux-china/toolchains-maven-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144157,"owners_count":21054876,"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":["maven-plugin","toolchains"],"created_at":"2024-11-06T21:41:56.397Z","updated_at":"2025-04-10T02:30:37.326Z","avatar_url":"https://github.com/linux-china.png","language":"Java","readme":"\u003c!--\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n      http://www.apache.org/licenses/LICENSE-2.0\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n--\u003e\nToolchains Maven Plugin\n=========================\n\nExtend maven-toolchains-plugin to add JDK auto download and toolchains.xml management.\n\n# Features\n\n* JDK auto download by Foojay API support, and install directory is `~/.m2/jdks`\n* Add new toolchain into toolchains.xml dynamically\n* SDKMAN integration: add JDK to toolchains.xml from [SDKMAN](https://sdkman.io/) if SDKMAN detected\n* JBang integration: add/auto-install JDK to toolchains.xml from [JBang](https://www.jbang.dev/) if jbang detected\n\n# Requirements\n\n* Maven 3.5+\n* JDK 1.7+\n\n# How to use?\n\nAdd following plugin configuration to your pom.xml:\n\n```xml\n\n\u003cbuild\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.mvnsearch\u003c/groupId\u003e\n            \u003cartifactId\u003etoolchains-maven-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e4.5.0\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003etoolchain\u003c/goal\u003e\n                    \u003c/goals\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n            \u003cconfiguration\u003e\n                \u003ctoolchains\u003e\n                    \u003cjdk\u003e\n                        \u003cversion\u003e17\u003c/version\u003e\n                    \u003c/jdk\u003e\n                \u003c/toolchains\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/build\u003e\n```\n\nAnd you can try it quickly:\n\n```\n$ git clone https://github.com/linux-china/java17-demo.git\n$ cd java17-demo\n$ mvn compile\n```\n\n# GraalVM support\n\n* vendor should be `graalvm_ce17` or `graalvm_ce11`\n* version is GraalVM version(not Java version), such as `22.3` or `22.3.0`\n* GraalVM native-image component will be installed automatically\n\n```xml\n\n\u003cplugin\u003e\n    \u003cgroupId\u003eorg.mvnsearch\u003c/groupId\u003e\n    \u003cartifactId\u003etoolchains-maven-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e4.5.0\u003c/version\u003e\n    \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003etoolchain\u003c/goal\u003e\n            \u003c/goals\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n    \u003cconfiguration\u003e\n        \u003ctoolchains\u003e\n            \u003cjdk\u003e\n                \u003cversion\u003e22.3\u003c/version\u003e\n                \u003cvendor\u003egraalvm_ce17\u003c/vendor\u003e\n            \u003c/jdk\u003e\n        \u003c/toolchains\u003e\n    \u003c/configuration\u003e\n\u003c/plugin\u003e\n```\n\n# How to get a list of all supported distributions and JDK versions?\n\nPlease visit https://api.foojay.io/disco/v3.0/distributions to get all information.\n\n* jdk vendor is the value of `api_parameter`\n* jdk version value could be any value in `versions` array\n\nOr you can use [Maven toolchains CLI](https://github.com/linux-china/maven-toolchains-cli) to get all supported JDKs information.\n\n![Maven toolchains CLI](maven-toolchains-cli.png)\n\n# How to skip toolchains maven plugin on CI/CD platform?\n\n```\n$ mvn -Dtoolchain.skip -DskipTests package\n```\n\n# Different JDK for main/test code\n\nMaven has support for using different source and target java versions for your project's main code and tests.\nYou can add `testJdk` toolchain in `toolchains-maven-plugin` to specify the JDK for test code as below:\n\n```xml\n\n\u003cplugins\u003e\n    \u003cplugin\u003e\n        \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003emaven-compiler-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e3.11.0\u003c/version\u003e\n        \u003cexecutions\u003e\n            \u003cexecution\u003e\n                \u003cid\u003edefault-testCompile\u003c/id\u003e\n                \u003cphase\u003etest-compile\u003c/phase\u003e\n                \u003cgoals\u003e\n                    \u003cgoal\u003etestCompile\u003c/goal\u003e\n                \u003c/goals\u003e\n                \u003cconfiguration\u003e\n                    \u003cjdkToolchain\u003e\n                        \u003cversion\u003e18\u003c/version\u003e\n                    \u003c/jdkToolchain\u003e\n                \u003c/configuration\u003e\n            \u003c/execution\u003e\n        \u003c/executions\u003e\n        \u003cconfiguration\u003e\n            \u003csource\u003e8\u003c/source\u003e\n            \u003ctarget\u003e8\u003c/target\u003e\n            \u003cparameters\u003etrue\u003c/parameters\u003e\n            \u003ctestSource\u003e18\u003c/testSource\u003e\n            \u003ctestTarget\u003e18\u003c/testTarget\u003e\n            \u003ctestRelease\u003e18\u003c/testRelease\u003e\n            \u003ctestCompilerArgument\u003e--enable-preview\u003c/testCompilerArgument\u003e\n        \u003c/configuration\u003e\n    \u003c/plugin\u003e\n\n    \u003cplugin\u003e\n        \u003cgroupId\u003eorg.mvnsearch\u003c/groupId\u003e\n        \u003cartifactId\u003etoolchains-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e4.5.0\u003c/version\u003e\n        \u003cexecutions\u003e\n            \u003cexecution\u003e\n                \u003cgoals\u003e\n                    \u003cgoal\u003etoolchain\u003c/goal\u003e\n                \u003c/goals\u003e\n            \u003c/execution\u003e\n        \u003c/executions\u003e\n        \u003cconfiguration\u003e\n            \u003ctoolchains\u003e\n                \u003cjdk\u003e\n                    \u003cversion\u003e8\u003c/version\u003e\n                \u003c/jdk\u003e\n                \u003ctestJdk\u003e\n                    \u003cversion\u003e18\u003c/version\u003e\n                \u003c/testJdk\u003e\n            \u003c/toolchains\u003e\n        \u003c/configuration\u003e\n    \u003c/plugin\u003e\n\u003c/plugins\u003e\n```\n\n# References\n\n* Apache Maven Toolchains Plugin: https://maven.apache.org/plugins/maven-toolchains-plugin/\n* Maven toolchains CLI: https://github.com/linux-china/maven-toolchains-cli\n* Disco CLI: a command line interface for the foojay.io Disco API - https://github.com/HanSolo/discocli\n* foojay DiscoAPI: https://api.foojay.io/swagger-ui/\n* Gradle Toolchains for JVM：https://docs.gradle.org/current/userguide/toolchains.html\n\n\nsdkman support: sdk install java 17.0.7-graalce\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Ftoolchains-maven-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinux-china%2Ftoolchains-maven-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Ftoolchains-maven-plugin/lists"}