[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eThe default Java version used is the latest Java 11, but you can specify a different version using the \u003ccode\u003eGOOGLE_RUNTIME_VERSION\u003c/code\u003e environment variable, such as \u003ccode\u003e17\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eMaven and Gradle dependency configuration is supported, and you can use the \u003ccode\u003eMAVEN_OPTS\u003c/code\u003e and \u003ccode\u003eGRADLE_OPTS\u003c/code\u003e environment variables respectively to configure them.\u003c/p\u003e\n"],["\u003cp\u003eYou can use the Google Cloud hosted mirror of Maven Central by specifying the available URLs, or configure other mirrors following the instructions for Maven or Gradle.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize custom Maven \u003ccode\u003esettings.xml\u003c/code\u003e, copy it to your application directory and use \u003ccode\u003eGOOGLE_BUILD_ARGS=--settings <path/to/settings>\u003c/code\u003e to point to it during build.\u003c/p\u003e\n"]]],[],null,["# Building a Java application\n\nSpecify a Java version\n----------------------\n\nBy default, the latest version of Java 11 is used. If your\napplication requires a specific version, you can use the\n`GOOGLE_RUNTIME_VERSION` environment variable to specify a JDK version: \n\n pack build sample-java --builder=gcr.io/buildpacks/builder \\\n --env GOOGLE_RUNTIME_VERSION=17\n\n\nYou can also use a `project.toml` project descriptor to encode\nthe environment variable alongside your project files. See instructions on\n[building the application with environment variables](/docs/buildpacks/set-environment-variables#build_the_application_with_environment_variables)).\n\nManage dependencies\n-------------------\n\nDependency configuration is supported for projects that use\nMaven or Gradle.\n\n### Configure Maven\n\nMaven configurations can be applied using the `MAVEN_OPTS` environment variable.\nSee [documentation](https://maven.apache.org/configure.html) for\nadditional instructions.\n\nExamples:\n\n- `MAVEN_OPTS=-Xms256m -Xmx512m` passes these flags to the JVM running Maven.\n- `MAVEN_OPTS=--add-opens java.base/java.lang=ALL-UNNAMED` to suppress \"illegal reflective access\" warnings from Maven.\n\nTo manage your project's dependency on Maven itself, you can use the\n[Maven Wrapper](https://maven.apache.org/wrapper/). If you do not use the\nMaven Wrapper, buildpacks defaults to using a recent version of Maven\nwhen running `pack build`.\n\n### Configure Gradle\n\nGradle configurations can be applied using the `GRADLE_OPTS` environment\nvariable. See\n[documentation](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties)\nfor additional instructions.\n\nExample:\n\n`GRADLE_OPTS=-Xms256m -Xmx512m` passes these flags to the JVM running Gradle.\n\n### Google Cloud hosted Maven Central mirror\n\nYou can use the hosted mirror of Maven Central by specifying the\n[available URLs](https://storage-download.googleapis.com/maven-central/index.html).\n\n#### Mirror repositories in Maven\n\nTo configure a mirror, follow the\n[Using Mirrors for Repositories](https://maven.apache.org/guides/mini/guide-mirror-settings.html)\ninstructions in the Maven project documentation.\n\nCreate a copy of the `settings.xml` from the default location of\n`~/.m2/settings.xml` to inside your application source directory and specify\n`GOOGLE_BUILD_ARGS=--settings \u003cpath/to/settings\u003e`.\n\n**Note:** is relative to the source directory.\n\nExample `settings.xml` file: \n\n \u003csettings\u003e\n \u003cmirrors\u003e\n \u003cmirror\u003e\n \u003cid\u003egoogle-maven-central\u003c/id\u003e\n \u003cname\u003eCloud Storage Maven Central mirror\u003c/name\u003e\n \u003curl\u003ehttps://maven-central.storage-download.googleapis.com/maven2/\u003c/url\u003e\n \u003cmirrorOf\u003ecentral\u003c/mirrorOf\u003e\n \u003c/mirror\u003e\n \u003c/mirrors\u003e\n \u003c/settings\u003e\n\n#### Mirror repositories in Gradle\n\nTo configure a mirror, follow the\n[Declaring Repositories](https://docs.gradle.org/current/userguide/declaring_repositories.html)\ninstructions in the Gradle project documentation.\n\nExample `build.gradle` entry: \n\n repositories {\n maven {\n url \"https://maven-central.storage-download.googleapis.com/maven2/\"\n }\n }"]]